微信小程序实现遮罩及阻止遮罩层下的页面滚动


转自:https://www.jianshu.com/p/6fb10c78bbd7

实现遮罩效果

  • Html
    <view class='mask-view'>
      ...
    </view>

     

  • CSS
    .mask-view {
      width: 100%;
      height: 100%;
      position: fixed;
      overflow: hidden;
      background-color: #ffffff;
      z-index: 999;
      top: 0;
      left: 0;
    }

     

阻止遮罩层下的页面滚动

只需要在遮罩层上加上catchtouchmove='ture'
需要注意的是:因模拟器无touch事件,需在真机上测试

 
<view class='mask-view'  catchtouchmove='ture'>
  ...
</view>


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM