swiper中处理iframe或超过一页的元素滚动

1,126 阅读1分钟

在swiper配置中增加如下配置

noSwiping: true 不可拖动块的类名,当noSwiping设置为true时,并且在slide(或其他元素)加上此类名,目标将无法触摸拖动。

然后在所需要的iframe或其他元素的包裹容器上设置相应属性即可

<div class='wrapper'>
    <iframe src='...' scrolling='no'/>
</div
.wrapper {
    width: 100%;
    height: 100%;
    overflow: scroll;
    -webkit-overflow-scrolling:touch //使ios滚动流畅
}
iframe  {   //解决iframe在ios上不能正常100%宽度的问题
    width: 1px !important
    min-width: 100% !important
    height: 100%
}