Jump to content
Search Community

invalid scrollTo tween value: [object Object]

raffademello test
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

Good Morning Guys;


I want to scroll the current article when I click to the next or prev link, but on console browser shows the following information :

invalid scrollTo tween value: [object Object]


The HTML Structure is :


                        <div class="mask-articles">
                                <article class="history-article-1">

                               <article class="history-article-2">

                               <article class="history-article-3">


and the JS


        /* Time Line Quem Somos*/
        var section = 0;
        var sectionTotal = $(".mask-articles > article").length - 1;
        var article = $(".mask-articles > article");


        $(".prev-history").click(function (e) {

            if (section > 0) {

        $(".next-history").click(function (e) {

            if (section < sectionTotal) {

            //TweenMax.to(window, 0.5, {scrollTo:{y:$("#div" + section).offset().top}});


Somebody can help me ?


Thank you.

Link to comment
Share on other sites

Hello  raffademello, and welcome to the GreenSock forum!


Without seeing your code live, it would be hard to see what you are seeing in context.


Looks like your offset is missing the parenthesis offset(), please see jQuery offset() docs.

Also here is an example of the GSAP ScrollToPlugin in action:


See the Pen AsLfc by jonathan (@jonathan) on CodePen


Using window  for the tween target, your code in a codepen example (i didn't know what your css looks like):


See the Pen Akorc by jonathan (@jonathan) on CodePen

If this doesn't help, here is a nice video by GreenSock on how to create a codepen demo example, so we can better help you!





  • Like 3
Link to comment
Share on other sites

  • 4 months later...

I would like to add an observation about this error message, i was getting the same message when i was missing the correct import of the scrollTo plugin .js file, so if you get this problem and the tween values look right, take a look at that.


Awesome library, by the way.

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...