Jump to content
Search Community

Can't get scrollTo to work...

epborden 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

Here is my code.

TweenLite.to(options.element.selector, options.duration.attract, {
  scrollTo: {
    y: options.columns.left.height() - 1920
  },
  ease: options.easing,
  onComplete: function () {
  _this.scroller(true);
  }
});

Where:

 

options.element.selector = string of element

options.duration.attract = integer value

options.column.left.height() = height of element - height of window

options.easing = Linear.easeNone

_this.scroller(true) = special function that repeats things

 

All I am getting is this message: invalid scrollTo tween value: [object Object]

 

Here is the code as if it were written using jQuery animate, which works:

 

options.element.animate({
  scrollTop: options.columns.left.height() - 1920
}, {
  duration: options.duration.attract,
  easing: options.easing,
  complete: function () {
    _this.scroller(true);
  }
});
Link to comment
Share on other sites

Hi and welcome to the GreenSock forums,

 

Please make sure you are loading the ScrollToPlugin

<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/1.16.1/plugins/ScrollToPlugin.min.js"></script>

If you still need help, please provide a demo as explained here: http://greensock.com/forums/topic/9002-read-this-first-how-to-create-a-codepen-demo/

 

Thanks!

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