event.preventDefault和恢复元素默认事件

 

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

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

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

以Jquery为例

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

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

就OK了

原文地址:https://www.cnblogs.com/0808bing/p/3626008.html