nk-o / jarallax

Parallax scrolling for modern browsers
https://jarallax.nkdev.info
MIT License
1.38k stars 210 forks source link

Disable Parallax or Disable Video Does not work when using data-disable-parallax="true" #225

Closed BackuPs closed 2 months ago

BackuPs commented 2 months ago

Issue description:

Disable Parallax or Disable Video Does not work when using data-disable-parallax="true" or data-disable-video="true"

Version used:

(Did you try using the develop branch from GitHub? There's a chance your issue has already been addressed there) 2.2.0

Code to reproduce the issue (HTML blocks + JavaScript initialization)


Just add  data-disable-video = "true" data-disable-parallax = "true"  to the html code in the html demo.

This code in the script is responsible for not working of that code.

      if (typeof self.options.disableVideo !== 'function') {
        self.options.disableVideo = () => false;
      }

     should be changed to

      if (self.options.disableVideo == true) self.options.disableVideo = () => true;
      else self.options.disableVideo = () => false;

      and this

      if (typeof self.options.disableParallax !== 'function') {
        self.options.disableParallax = () => false;
      }

      should be changed to

     if (self.options.disableParallax==true) self.options.disableParallax = () => true;
     else self.options.disableParallax = () => false;