Created
October 1, 2013 16:43
-
-
Save deepfriedmind/6781459 to your computer and use it in GitHub Desktop.
A simple JavaScript function I wrote to toggle between enabling/disabling scrolling on mobile touch devices.
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
var toggleTouchScroll = function() { | |
var d = document; | |
if (typeof d.ontouchmove === 'object') return d.ontouchmove = function() { | |
return false; | |
}; | |
if (typeof d.ontouchmove === 'function') return d.ontouchmove() ? d.ontouchmove = function() { | |
return false; | |
} : d.ontouchmove = function() { | |
return true; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment