文章内容
1、需要在iframe外面包裹一层div
1 2 3 | < div class = "scroll-wrapper" > < iframe src = "" ></ iframe > </ div > |
2、设置scroll-wrapper的样式,给scroll-wrapper添加
1 | -webkit-overflow-scrolling: touch; overflow-y : scroll ; |
让外部的div进行滚动,然后保持iframe宽高100%
1 2 3 4 5 6 7 8 | .iframeDiv{ -webkit-overflow-scrolling: touch; overflow : scroll ; iframe{ width : 100% ; height : 100% ; } } |