简体   繁体   中英

jQuery - iPad/iPhone - enable scrolling after disabling it

I have disabled scrolling on the iPad using:

function disableScrolling() {
    document.ontouchmove = function(e){
            e.preventDefault();
    }
}

Is there a way to simply enable it again?

It would be especially helpful in a function like:

function enableScrolling() {
    // enable scrolling
}

This should work,

var disableScroll = false;

function disableScrolling() {
    disableScroll = true;
}


function enableScrolling() {
    disableScroll = false;
}

document.ontouchmove = function(e){
   if(disableScroll){
     e.preventDefault();
   } 
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM