Skip to content

Instantly share code, notes, and snippets.

@deepfriedmind
Created October 1, 2013 16:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save deepfriedmind/6781459 to your computer and use it in GitHub Desktop.
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.
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