Jump to content
Search Community

ScrollTo: Not enogh arguments?

Mullingar_Dev test
Moderator Tag

Go to solution Solved by Carl,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I'm trying to put together a full window slider that reacts to key presses (in this case he right and left key) as the basis for an interactive graphic novel.
However I'm having issues with the scrollto method, I am trying to scroll horizontally to a section but when I try it, it doesn't work and the console reads "TypeError: Not enough arguments to Window.scrollTo."

I have seen similar issues on the board but haven't found a solution that has worked for me, any ideas at all?
 

See the Pen MYYeKR by anon (@anon) on CodePen

Link to comment
Share on other sites

  • Solution

Hi and thanks for the demo.

Seems that pen wasn't loading ScrollToPlugin and it wouldn't run as there was an error about an extra }.

 

Also, it seems you are passing a class selector into ScrollToPlugin like ".s2", you need to pass in a numeric value.

Not really sure how everything is supposed to work, but I added a tween that will scroll the page to the second panel after 1 second (no key presses)

TweenLite.to(window, 1, {scrollTo:{x:$(".s1").position().left}, ease:Power2.easeOut, delay:1});

http://codepen.io/anon/pen/XJJKNW

 

ScrollToPlugin docs: http://greensock.com/docs/#/HTML5/GSAP/Plugins/ScrollToPlugin/

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