Skip to content

Instantly share code, notes, and snippets.

@riix
Created July 24, 2012 06:20
Show Gist options
  • Save riix/3168353 to your computer and use it in GitHub Desktop.
Save riix/3168353 to your computer and use it in GitHub Desktop.
IFRAME
// IFRAME 개체 셀렉트 sample - iframe ID
$('#Form_Body',window.frames["sample"].window.document);
// put on the page that calls the iframe
$(function () {
var iFrames = $('iframe');
function iResize() {
for (var i = 0, j = iFrames.length; i < j; i++) {
iFrames[i].style.height = iFrames[i].contentWindow.document.body.offsetHeight + 'px';
}
}
if ($.browser.safari || $.browser.opera) {
iFrames.load(function () {
setTimeout(iResize, 0);
});
for (var i = 0, j = iFrames.length; i < j; i++) {
var iSource = iFrames[i].src;
iFrames[i].src = '';
iFrames[i].src = iSource;
}
} else {
iFrames.load(function () {
this.style.height = this.contentWindow.document.body.offsetHeight + 'px';
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment