Jump to content


TweenMax.set not working properly with scrollTo plugin

Moderator Tag

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 am using TweenMax to shoot to a certain point of the page like so:


TweenMax.set(map.win, {
    scrollTo : { y: val } 
This goes to the wrong position but works properly elsewhere in my code strangely... :huh:
for now I am doing this instead and works properly, but feels like a gimmick:
TweenMax.to(map.win, 0.000001, {
    scrollTo : { y: val }
Any help would be appreciated!
Link to comment
Share on other sites

Hi and welcome to the GreenSock forums,


It would be of great help if you can create a reduced test case that clearly shows when it doesn't work as it will be difficult for us to try to simulate the conditions in which it doesn't work for you.


Feel free to fork this CodePen example: http://codepen.io/anon/pen/LlIjm


If you need a primer on how to use CodePen read this: http://forums.greensock.com/topic/9002-read-this-first-how-to-create-a-codepen-demo/



  • Like 1
Link to comment
Share on other sites

  • 2 years later...

I am seeing this issue as well.


Seems like it's not working with elements... only with window: Here is the edited codePen:


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

Link to comment
Share on other sites

Hmm. It seems to be working. But only after I wait an animation frame... It seems can't set the scroll until after the element has been drawn to the screen...

Link to comment
Share on other sites

hmm, it seems that way your css is set up that container is not getting any scrollbars and thus there really is nowhere to scroll to.


Modifying the CSS to allow container to be scrollable appears to work fine.




I don't think this is an issue with scrollToPlugin. If you edit your pen to use jQuery's scrollTop() you get the same result

TweenLite.delayedCall(1, scroll)

function scroll(){
  • 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.