Solved

jquery check if iframe is visible

Posted on 2011-03-01
3
1,671 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 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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

ASP.NET AJAX callbacks to web service are becoming very popular and unavoidable these days. The feel that the user gets when only a part of the page is updated without even hindering the UI is the advantage that the callbacks offer. The wait for the…
jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

770 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