Jump to content
Search Community

ScrollToPlugin.js:87 scrollTo target doesn't exist. Using 0

Pollux Septimus test
Moderator Tag

Recommended Posts

Hi,

I have created this demo using only javascript but in my project I am using React.

Someone on this forum helped me find a way to scroll to the specific image when clicking on a nav item.

That person suggested to use SctollToPlugin but in my react project it does not work. The error that I receive is the one in the title (ScrollToPlugin.js:87 scrollTo target doesn't exist. Using 0).  It points to this specific line sliderContainer.scrollTop.

 

This is how I imported the plugins

import gsap from 'gsap'

import { ScrollTrigger } from 'gsap/ScrollTrigger;

import { ScrollToPlugin } from 'gsap/ScrollToPlugin ;

 

 

gsap.registerPlugin(ScrollTrigger);

gsap.registerPlugin(ScrollToPlugin);

This part is inside the useEffect.

 

Does the ScrollToPlugin need to be installed separately from gsap? Like: yarn add ScrollToPlugin ?

See the Pen rNdLomM by raul-rogojan (@raul-rogojan) on CodePen

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