javascriptjquerymobileparallax.js

How to disable parallax wagerfield on small resolution?


I use this parallax, but can't disable it on mobile?

I found some methods like this:

scene = $('#scene').parallax();
scene.parallax('disable');

But it didn't work. Can anybody help?


Solution

  • If you want to disable parallax straight after it's been initialized you should wrap your scene.parallax('disable'); in a setTimeout function. If you look at the source code of Parallax.js you will see that there's supportDelay: 500 value which is used as an argument in enable function. According to that your code for disabling would look like this:

    var scene = $('#scene').parallax();
    setTimeout(function () {
      scene.parallax('disable');
    }, 500);
    

    Update: Just found an article that explains different perspective on disabling parallax.js on small devices.