版权声明:本文首发 http://asing1elife.com ,转载请注明出处。 https://blog.csdn.net/asing1elife/article/details/83104274
iframe在ios的safari中无法通过height:100%控制高度
更多精彩
- 更多技术博客,请移步 asing1elife’s blog
在iframe中加上scrolling="no"强制没有滚动条
<iframe id="courseContentFrame" name="courseContentFrame" src="JavaScript:;" scrolling="no">
</iframe>
在iframe动态加载内容后,通过js强制指定高度
var height = $courseLearningPanel.find(".course-content-panel").height();
$courseContentFrame.attr("height", height);
$courseContentFrame.css("min-height", height + "px !important");
$courseContentFrame.css("max-height", height + "611px !important");