微信小程序實現遮罩及阻止遮罩層下的頁面滾動


轉自: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