Jump to content
Search Community

Failed to execute 'scrollTo' on 'Window': parameter 1 ('options') is not an object.

Edon Rexhepi test
Moderator Tag

Recommended Posts

Hey Edon. Welcome to the GreenSock forums! 

 

You're using ScrollMagic, not the ScrollToPlugin like you mentioned in the post. Scroll Magic isn't a GreenSock product and we don't really recommend using it. However, we like to be helpful so if you want to post a demo in CodeSandbox or StackBlitz that recreates the error in Vue we're happy to at least take a look. It's pretty hard to help blindly :) 

  • Like 1
Link to comment
Share on other sites

Hi Zach, 

Thanks for the fast reply and the support given.

I tried to reproduce the error in CodeSandbox, sometimes the error is showing sometimes not. Here's the link: https://codesandbox.io/embed/goofy-ardinghelli-n7r57?fontsize=14&hidenavigation=1

 

Image attached.

 

I'm using ScrollMagic for the scene only, when the scene is reached I use GSAP to scroll

gsap.to(window, 0.25,{
  scrollTo: {
    y: '.hero-' + (index + 1),
    autoKill: false
  },
  ease: Power4.easeOut
}

 

Many thanks again for the help.

Screenshot 2020-03-06 at 22.04.07.png

Link to comment
Share on other sites

13 minutes ago, Edon Rexhepi said:

when the scene is reached I use GSAP to scroll

Oops, you're right. Sorry about that! The code formatting made it a little hard for me to see. I should have used my browser's search functionality to double check.

 

I'm not sure what's going wrong. But if I were doing this I wouldn't use Scroll Magic for sure (or likely jQuery or Vue, hah). Here's a thread on a full page slider that you can strip down to get what you need (it has a lot of bells and whistles that aren't relevant to your situation but the core approach is what you could use):

 

  • Like 2
Link to comment
Share on other sites

Hi again Zach,

 

Thank you again for the help. 

I read again the GSAP 3 Documentation, it seems that I had to register the plugin, so for Googlers in the future, this is how plugins should be registered: 

 

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

In the main script.

 

Many thanks again, 

Just saw the reply, thanks so much for sharing the asset!

 

Just started, and I love using GSAP! Good job to everyone.

Happy coding.

 

  • Like 6
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...