<script>  
function ask(){  
    $(".ask").click(function(){  
        $("body").css("overflow","hidden");  
        $(".popwind").show();  
        $('body').bind("touchmove",function(e){    
                    e.preventDefault();    
            });  
    });  
}  
ask();  
$(".pop_close").click(function(){  
    $("body").css("overflow","auto");  
    $(".popwind").hide();  
    $("body").unbind("touchmove");  
});  
</script>  

  

写页面事件的时候,有的时候需要用event.preventDefault取消原有的事件后进行重写,这个大家应该都知道。

那么怎么在取消默认事件后再恢复呢。

解绑我们自定义的事件就好了。

以Jquery为例

我们用$(“body”).bind(“touchmove”,function(event){event.preventDefault;//code});取消了body的拖动事件。

恢复这个拖动事件只要$(“body”).unbind(“touchmove”);

相关文章:

  • 2021-11-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-09
  • 2021-12-27
  • 2021-12-29
  • 2021-11-14
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-19
  • 2021-11-28
  • 2021-11-25
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案