tags:

views:

20

answers:

1

Hello,

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

loaded();

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

A: 

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

Paddy
Basically after I run loaded(), I want to un-run it in some way.
Alec Smart