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

 

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

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

解绑咱们自定义的事件就行了。it

以Jquery为例io

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

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

就OK了class

相关文章
相关标签/搜索