【问题标题】:Bind and Unbind Scrolling (using touchmove or difference solution)绑定和取消绑定滚动(使用 touchmove 或差异解决方案)
【发布时间】:2014-05-31 14:30:35
【问题描述】:

我有一个简单的问题,如何在移动设备上禁用和启用滚动一段时间?经过快速搜索,我找到了这个

  jQuery("body").bind("touchmove",function(e){
        e.preventDefault();
        return false;
  });   

完美运行,但如何再次启用它?我有两个功能

function mobilePopUp()
{
      jQuery("body").bind("touchmove",function(e){
            e.preventDefault();
            return false;
      });  
}

function mobilePopUpClose
{
  // there i want to enable it back
}

绑定 touchmove 事件是否可能返回 false?我应该用 touchmove 绑定其他任何东西以知道我应该取消绑定什么吗?也许实现函数名称 idk。感谢您的帮助

【问题讨论】:

    标签: jquery mobile


    【解决方案1】:

    是的,只需 unbind 即可。

    function mobilePopUpClose
    {
       jQuery("body").unbind("touchmove");
    }
    

    【讨论】:

    • thx 它可以工作,但还有另一个问题(我没有意识到)我需要停止滚动,但我的某些元素需要 touchmove :-/ 你回答了我的问题,所以我不能完成它,但如果你知道如何禁用仅滚动请让我现在
    • @user3051762,请再问一个问题并给我网址。就算我不知道怎么解决,别人也会帮你的。
    猜你喜欢
    • 2018-12-14
    • 2012-02-29
    • 1970-01-01
    • 1970-01-01
    • 2018-02-07
    • 1970-01-01
    • 1970-01-01
    • 2013-07-21
    • 2015-07-03
    相关资源
    最近更新 更多