[英]Adjust Iframe height
Is there any method available to adjust the height of an iframe (which loads an external site) dynamically ? 有没有可用的方法来动态调整iframe(可加载外部网站)的高度?
OR 要么
is there any way to check whether if the iframe has a scroll-bar present ? 有什么方法可以检查iframe是否存在滚动条?
Try this: 尝试这个:
// Get the iFrame jQuery Object
var $MyFrame = $("#iframeid");
// You need to wait for the iFrame content to load first
// So, that the click events work properly
$MyFrame.load(function () {
var frameBody = $MyFrame.contents().find('body');
// Set the iFrame height
$MyFrame.css({
height: frameBody.outerHeight()
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.