开发者

How to e.startDefault when e.preventDefault is set?

function loaded() {
    document.addEventListener('touchmove', fu开发者_如何学运维nction(e){ e.preventDefault(); });
}

loaded();

At certain times I want to allow default. How can I do that?


Depending on what you want, something like:

function loaded() {
    document.addEventListener('touchmove', function(e){ 
         if (conditionToPreventDefault) { e.preventDefault(); } });
}

Based on your comment, I think you need removeEventListener - see here for explanation:

http://www.quirksmode.org/js/events_advanced.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜