You can use modernizr touch detection to check if it is a touch device, and if so, do not run the script.
if (Modernizr.touch) { } else { skrollr.init(); }
or you can check the user agent (this may not be the best option, since the user agent is not always reliable), and write a simple, if otherwise, using skrollr init in else
var isMobile = { Android: function () { return navigator.userAgent.match(/Android/i); }, BlackBerry: function () { return navigator.userAgent.match(/BlackBerry/i); }, iOS: function () { return navigator.userAgent.match(/iPhone|iPad|iPod/i); }, Opera: function () { return navigator.userAgent.match(/Opera Mini/i); }, Windows: function () { return navigator.userAgent.match(/IEMobile/i); }, any: function () { return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); } }; if (isMobile.any()) { } else { skrollr.init(); }
Another testing method would be to check window.innerWidth and only initialize your script if the screen size is more than 760px:
if (window.innerWidth > 760) { skrollr.init(); }
source share