zoukankan      html  css  js  c++  java
  • 移动端禁止遮罩层以下屏幕滑动

    var ruleTxt = $(".wanfan .rule .rule-txt");
    var ruleTxtBottom = $(".wanfan .rule .rule-txt .rule-txt-bottom");
    var flag = '';
    $(".wanfan .rule .rule-btn").on('click',function(){
    var h=window.screen.height;
    ruleTxt.css({'width':'100%','left':'0px'});
    ruleTxtBottom.css({'height':h/2});
    $(".rule .rule-txt").animate({'bottom':'0px'});
    flag = 1;

    });
    document.addEventListener('touchmove', function (event) {    //监听滚动事件
    if(flag==1){                            //判断是遮罩显示时执行,禁止滚屏
    event.preventDefault();                   //最关键的一句,禁止浏览器默认行为
    }
    });

    $(".wanfan .rule .rule-txt-top span").click(function(){
    $(".rule .rule-txt").animate({'bottom':'-100%'});
    flag = 0;
    });

    发现连遮罩层都不能滑动了,只能用到选择器;

    http://www.cnblogs.com/licf/p/4691556.html

    作者:freddyhuang
    出处:https://www.cnblogs.com/freddyhuang
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    emacs jedi
    opencv 基本demo
    emacs列编辑
    observable operator example
    angular keydown 例子
    回调和匿名函数
    gin cors
    angular rxjs
    python dbus note
    视频截图
  • 原文地址:https://www.cnblogs.com/freddyhuang/p/5852622.html
Copyright © 2011-2022 走看看