Created
April 11, 2012 11:24
-
-
Save 14021939/2358719 to your computer and use it in GitHub Desktop.
iframe preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The page name is index.html has iframe window in itself, The iframe page is preview.html | |
If you want to handling iframe element by js loaded in index.html, That case can't handling if iframe was loaded faster than index.html. | |
And to no effect links or input tags,You load js that is changes no effect by preview.html better. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="preview" style="visibility: hidden"> | |
<iframe src='preview.html' id="preview"></iframe> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* preview.js | |
* load in index.html page | |
*/ | |
// After index.html page was loaded, iframe turn visible. | |
// Because of the case, preview.html in iframe was loaded is faster than index.html was loaded, | |
// js was loaded in index.html can't move. | |
$(function(){ | |
$(window).load(function(){ | |
$('.preview').css("visibility", ""); | |
}); | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* preview_page.js | |
* load in preview.html page | |
*/ | |
$(function(){ | |
$('a').attr("href", "#").removeAttr("target"); | |
$('input').attr("disabled","disabled"); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment