Created
March 24, 2011 12:10
-
-
Save avhm/884950 to your computer and use it in GitHub Desktop.
Prevent iPhone scrolling on demand
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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