开发者

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

开发者 https://www.devze.com 2023-01-18 11:00 出处:网络
function loaded() { document.addEventListener(\'touchmove\', fu开发者_如何学运维nction(e){ e.preventDefault(); });
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

精彩评论

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