Allows TweenLite and TweenMax to animate the scroll position of the window (like doing window.scrollTo(x, y)) or a <div> DOM element (like doing myDiv.scrollTop = y; myDiv.scrollLeft = x;).

To scroll the window to a particular position, use window as the target of the tween like this:

//scroll to 400 pixels down from the top, 2, {scrollTo:400});

//or to scroll to the element with the ID "#someID":, 2, {scrollTo:"#someID"});

//or to specify which axis (x or y), use the object syntax:, 2, {scrollTo:{y:400, x:250}});

Or to tween the content of a div, make sure you've set the overflow:scroll on the div and then do this:

//scroll to 250 pixels down from the top of the content in the div, 2, {scrollTo:250});

Learn more in the ScrollToPlugin documentation.


Version: 2.1.3 updated 2019-05-18




        By using GreenSock code, you agree to the terms of use.

        For an all-access pass to premium content

        Join Club GreenSock