Jump to content
Search Community

Unable to load ScrollToPlugin with npm

romain.gr test
Moderator Tag

Recommended Posts

Hi, I've been trying to use ScrollToPlugin but I'm unable to install it via npm. I was on the page https://greensock.com/docs/v2/NPMUsage, but it's confusing, is the ScrollToPlugin installed when you do npm install gsap?

 

That's how looks my import but it seems that the ScrollToPlugin is missing, and I can't figure out how to install it :

 

 

import { gsap, Expo } from 'gsap/all';
import ScrollToPlugin from 'gsap/all';
gsap.registerPlugin(ScrollToPlugin);

 

When I do 

 

gsap.to(window, { duration: 2, scrollTo: centerVidPos });

 

I have a console log error saying

 

gsap-core.js:3323 Uncaught TypeError: Failed to execute 'scrollTo' on 'Window': parameter 1 ('options') is not an object.

 

Do I even need to register the plugin after importing it? Is there some complete documentation on the gsap website? How can I install the ScrollToPlugin via npm and how to use import/register it?

 

Completly confused.

Link to comment
Share on other sites

6 minutes ago, romain.gr said:

I was on the page https://greensock.com/docs/v2/NPMUsage, but it's confusing, is the ScrollToPlugin installed when you do npm install gsap?

That's the v2 installation docs. Use the v3 installation docs as that's the version you are actually importing from npm.

 

7 minutes ago, romain.gr said:

Do I even need to register the plugin after importing it? Is there some complete documentation on the gsap website? How can I install the ScrollToPlugin via npm and how to use import/register it?

Yep, it's covered in the GSAP 3 docs linked to above.

 

If you need additional help, please make a minimal demo of the issue!

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...