Disable Skrollr for mobile device ( <767px )

Petef1n picture Petef1n · Oct 28, 2013 · Viewed 17.7k times · Source

Firstly would like to thanks @prinzhorn for such an amazing and powerful library. My question: I have implemented a Skrollr parallax background to the header of my website but I would like to disable this feature when viewed on a mobile device, particularly iphones, etc. eg. (max-width: 767px).I was wondering what would be the best way to do this? And if the destroy() function was able to do this or I should be using another technique? Also, if destroy() is the answer, how could I implement this correctly? Many thanks and examples or demo's greatly appreciated.

Answer

fatlinesofcode picture fatlinesofcode · Nov 19, 2014

Skrollr has its own mobile check function

var s = skrollr.init();
if (s.isMobile()) {
    s.destroy();
}