Solved

jquery check if iframe is visible

Posted on 2011-03-01
3
1,697 Views
Last Modified: 2012-05-11
Hello Experts,

Parent:
<IFRAME id="login" SRC="login.html"></IFRAME>

When I initially load this screen, I hide the iframe using
$('#login').hide();

I currently have code in login.html that adjusts the height of the iframe:
$(function() {
$('#login',window.top.document).height(170);
});

However, when this code is called, the iframe that was hidden in the parent becomes visible.
How do I execute this code so that it is only executed if the iframe is visible?

Thanks
0
Comment
Question by:jagku
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 35010133
Maybe using : http://api.jquery.com/visible-selector/

$('#login:visible',window.top.document).height(170);

Open in new window

0
 

Author Comment

by:jagku
ID: 35012384
Hi,
I think I have really confused myself this time!
For some reason this isn't kicking in properly.

I have drafted 3 files (attached) to illustrate the problem:

parent.html CALLS login.html CALLS test.html

The problem is that although I try and hide the test.html iframe in login.html
- the piece of code that changes the height of the iframe 'login' listed in parent.html still kicks in (even though the test.html iframe is invisible.  I don't want it to execute.

Can you see what am I missing?

Many Thanks (as usual!)
parent.html
login.html
test.html
0
 

Author Closing Comment

by:jagku
ID: 35016444
Although it doesn't answer my question (which wasn't clear in the first place) - it helps.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello World !, Thanks : My Sincere thanks to @Michael Male who encouraged me to write an article on this in my  blog (http://scribblejava.wordpress.com). Introduction:       There are several technical issues a developer may face in his…
The Confluence of Individual Knowledge and the Collective Intelligence At this writing (summer 2013) the term API (http://dictionary.reference.com/browse/API?s=t) has made its way into the popular lexicon of the English language.  A few years ago, …

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question