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
精彩评论