找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索本站精品资源

首页 教程频道 小程序开发 查看内容

微信小程序滚动穿透问题

作者:模板之家 2018-1-24 11:04 1788人关注

做小程序项目遇到一个项目,就是点一个按钮出现一个蒙层,然而下面的页面还是可以滚动,解决如下: view bindtap=hideCoupon class=coupon_receive_wrapper {{showCouponFlag==true?active:}} catchtouchmov .

小程序项目遇到一个项目,就是点一个按钮出现一个蒙层,然而下面的页面还是可以滚动,解决如下: view bindtap="hideCoupon" class='coupon_receive_wrapper {{showCouponFlag==true?"active":""}}' catchtouchmov ...

 
 
 
 做小程序项目遇到一个项目,就是点一个按钮出现一个蒙层,然而下面的页面还是可以滚动,解决如下:
<view bindtap="hideCoupon" class='coupon_receive_wrapper {{showCouponFlag==true?"active":""}}' catchtouchmove="preventD">

 

样式如下 :

.coupon_receive_wrapper{
  display:none;
  position:fixed;
  left:0;
  top:0;
  right:0;
  bottom:0;
  width:100%;
  height:100%;
  background:rgba(0,0,0,.5);
  z-index:11;
  transition: all 1s ease;
}
.coupon_receive_wrapper.active{
  display:block;
}

给蒙层那个元素加个touchmove事件,这个事件用来阻止事件冒泡,preventD中的代码如下:preventD(){}问题就解决了。



路过

雷人

握手

鲜花

鸡蛋
原作者: 模板之家 来自: 网络收集

全部回复(0)