andru26
10/7/2018 - 6:55 PM

Scrollspy animate content on scroll

Scrollspy animate content on scroll Requirement: scrollspy.js

//fade & slide content on scroll

  (function animateContent(){

      var bottomAnimateDistance = -125;

      if (viewport() == "nonmobile"){
          bottomAnimateDistance = -250;
      }

      if($().scrollSpy && $(".scroll-animate").length > 0){

          $(".scroll-animate")
          .scrollSpy({
              offsetTop:0, offsetBottom:bottomAnimateDistance
          })
          .on("scrollSpy:enter", function() {
              $(this).addClass("init-animate");
          })
          .on("scrollSpy:exit", function() {
          });

      }

  })();