失效原因
当iframe的内容超出了iframe设定的高度时,在ipad、iphone等设备上,iframe内部html的滚动条不出现,超出iframe高度的会部分被截掉(类似overflow:hidden的效果)。
解决方法一
使用iframe或者其他html元素时,使用一个元素(如DIV)来包装他们:
<div class="scroll-wrapper">
<iframe src=""></iframe>
</div>
<style>
.scroll-wrapper {
-webkit-overflow-scrolling: touch;/* touch或auto */
overflow-y: scroll;
}
.scroll-wrapper iframe {
width:100%;
height:100%;
/* 你自己指定的样式 */
}
</style>
方法二
不使用iframe,直接使用网页跳转
function open(url){
window.open(url,'_blank','location=no');
}