Skip to content

Instantly share code, notes, and snippets.

@avhm
Created March 24, 2011 12:10
Show Gist options
  • Save avhm/884950 to your computer and use it in GitHub Desktop.
Save avhm/884950 to your computer and use it in GitHub Desktop.
Prevent iPhone scrolling on demand
iOsScrollingToggle : function(enabled){
function preventScroll(e){
e.preventDefault();
e.stopPropagation();
}
// This should prevent people from scrolling away from the modal window without closing it
if(enabled){
document.body.removeEventListener('touchmove',preventScroll,false);
} else {
document.body.addEventListener('touchmove',preventScroll,false);
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment