Jump to content
Search Community

VueJS Gsap

silverd test
Moderator Tag

Recommended Posts

Hello I have just this error and I have no idea why 

gsap_dist_ScrollTrigger__WEBPACK_IMPORTED_MODULE_12__.ScrollTrigger.scrollerProxy is not a function

The scrollTrigger works perfectly, I just wanted to add some smooth to my scroll :) so I added that part 
 


      // Smooth scroll setup
      const bodyScrollBar = Scrollbar.init(document.body, {
        damping: 0.1,
        delegateTo: document,
      });

      bodyScrollBar.setPosition(0, 0);
      bodyScrollBar.track.xAxis.element.remove();

      // How to get them to work together
      ScrollTrigger.scrollerProxy("body", {
        scrollTop(value) {
          if (arguments.length) {
            bodyScrollBar.scrollTop = value;
          }
          return bodyScrollBar.scrollTop;
        },
      });

the import works perfectly otherwise my timeline below would not works 
 

import { gsap } from "gsap/dist/gsap";
import { ScrollTrigger } from "gsap/dist/ScrollTrigger";
gsap.registerPlugin(ScrollTrigger);

import Scrollbar from "smooth-scrollbar";

so I am a bit confused because that part works fine
 

let sections = gsap.utils.toArray(".linkProject");

      let tl = gsap.timeline({
        defaults: { ease: "expo.inOut" },
        scrollTrigger: {
          trigger: ".projectsListing",
          scrub: 1,
          // markers: true,
          toggleActions: "restart pause reverse pause",
          end: "bottom 90%",
          // end: () =>
          //   "+=" + document.querySelector(".projectsListing").offsetHeight,
        },
      });

      tl.from(sections, {
        y: -120,
        opacity: 0,
        duration: 1.45,
        transformOrigin: "center",
        scale: 0.45,
        stagger: 0.75,
      });

the only part doesn't working in this is the end function he doesn't seem understand offsetHeight or offsetWidth but that is an other topic and probably related to vuejs :D 
 

Link to comment
Share on other sites

I have no error and the smooth scroll work perfectly but when I put it into the default layouts of vueJs all the animation depending of scroll-trigger doesn't work anymore 
did I forget something ? 

 

// Smooth scroll setup
      const bodyScrollBar = Scrollbar.init(document.body, {
        damping: 0.1,
        delegateTo: document,
      });

      bodyScrollBar.setPosition(0, 0);
      bodyScrollBar.track.xAxis.element.remove();

      // How to get them to work together
      ScrollTrigger.scrollerProxy("body", {
        scrollTop(value) {
          if (arguments.length) {
            bodyScrollBar.scrollTop = value;
          }
          return bodyScrollBar.scrollTop;
        },
      });

 

Link to comment
Share on other sites

Hello Zach thanks I will try it's just complicate because the project is on nuxtjs (vuejs) and so the document.body is probably weirdly understood by this framework because every time I uncomment that

// Smooth scroll setup
      const bodyScrollBar = Scrollbar.init(document.body, {
        damping: 0.1,
        delegateTo: document,
      });
      bodyScrollBar.setPosition(0, 0);
      bodyScrollBar.track.xAxis.element.remove();

      // How to get them to work together
      ScrollTrigger.scrollerProxy("body", {
        scrollTop(value) {
          if (arguments.length) {
            bodyScrollBar.scrollTop = value;
          }
          return bodyScrollBar.scrollTop;
        },
      });

everything outside the screen is hidden like with the overflow hidden but I can scroll just nothing to see :D 
I will try to do something on codepen or something like that for vue :) 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...