Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

jquery check if iframe is visible

Posted on 2011-03-01
3
Medium Priority
?
1,763 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
  • 2
3 Comments
 
LVL 83

Accepted Solution

by:
leakim971 earned 2000 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There is basically two types of AJAX request in mootools. Request  and Request.HTML Request: Request is the basic XHR request class in MooTools. While not extremely useful on its own, it provides the basic functionality for both Request.HTM…
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

926 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