Jump to content
Search Community

Unable to make the ScrollToPlugin Working

romain.gr test
Moderator Tag

Recommended Posts

Hi, 

 

I'm struggling doing something very simple, can someone explain me what's wrong with this :

 

$('a').on('click', function(e){
    e.preventDefault();

    var thisId = $(this).attr('href');

    console.log(thisId);
	
		TweenMax.to(window, {duration: 2, scrollTo: thisId});
		//TweenLite.to(window, {duration: 2, scrollTo: thisId});
		//TweenMax.to(window, {duration: 2, scrollTo: {y: '100', offsetY: 50}});
		//TweenMax.to(window, {duration: 2, scrollTo: 400});

});

I'm unable to make this work even tho it seems to be very simple to make it work, I'm following the documentation (well, I guess)

//scroll to 400 pixels down from the top
gsap.to(window, {duration: 2, scrollTo: 400});

//or to scroll to the element with the ID "#someID":
gsap.to(window, {duration: 2, scrollTo:"#someID"});

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

In my code, none of the commented is working + I'm using the old version of GSAP :

 

TweenMax  et ScrollToPlugin: Version 2.1.3

 

Thank you

 

//////////////////////////////////////////

 

Well, I'm not really sure why the documentation has been totally modified for the new version of GSAP, without leaving any information about the previous versions :

 

so for the previous version :

 

TweenMax.to(window, 2, {scrollTo: thisId});

 and for the new version :

 

TweenMax.to(window, {duration: 2, scrollTo: thisId});

 

Is it possible to still have access to the documentation for the previous Versions of GSAP or it has been deleted for ever?

 

See the Pen nqAwvWzGOYbr#section4 by romaingranai (@romaingranai) on CodePen

Edited by romain.gr
Found the answer to my question
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...