locomotivemtl / locomotive-scroll

🛤 Detection of elements in viewport & smooth scrolling with parallax.
https://locomotivemtl.github.io/locomotive-scroll
MIT License
7.97k stars 1.12k forks source link

Locomotive scroll disable JS/Jquery function #482

Closed yann0851 closed 1 year ago

yann0851 commented 1 year ago

Hello 👋

We are developing a website with locomotive scroll but we are having a problem, on the computer version everything is going well, our features are not having any problems, but when we switch to the phone, locomotive scroll deactivates the JS functions that we have created. For example 'addEventListener(click)' does not work. Can someone who has encountered this problem before help us?

'var acc = document.getElementsByClassName("service"); // prendre tous mes services

  for (let i = 0; i < acc.length; i++) {
    acc[i].addEventListener("click", function() {
        var panel = this.nextElementSibling;
        if (panel.classList.contains('vanish')) {

          setTimeout(function() {panel.classList.remove('hidden'), 1000});
          setTimeout(function() {panel.classList.remove('vanish'), 1000});
          setTimeout(function() {panel.classList.add('appearPanel'), 1000});
        }

    else{
            panel.classList.remove('appearPanel');
            setTimeout(function() {panel.classList.add('vanish'), 1000});;
    }
    const panel2 = document.querySelectorAll('.panel');
    for (var j = 0; j < panel2.length; j++){
      console.log(j);

      if(panel2[j].classList.contains('appearPanel')){

        panel2[j].classList.remove('appearPanel');
        panel2[j].classList.add('vanish');
        // panel2[j].classList.add('hidden');
      }
      // setTimeout(function() {panel2[j].classList.add('hidden'), 500});
    }
    });
  };'