Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
dwillis

scrollTo offset not working

Recommended Posts

Hi!

I'm using GSAP with ScrollMagic on a one-page site I'm developing. To scroll to a particular section I'm using the scrollTo plugin and it's working great but I need it to have an offset when it scrolls so the heading doesn't scroll under the nav. scrollTo helpfully provides an 'offsetY' property but for some reason it's not working for me. No matter what offset I put in, it scrolls to the same position. There are no console errors though. You can see it not working on the linked codepen demo. Here's the specific line:

TweenMax.to(window, 0.5, {scrollTo: {y: newpos, offsetY:70}});

Any idea what I'm doing wrong?

 

TIA!

 

David

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

Link to comment
Share on other sites

Hi dwillis :)
 
Looks like you're using older versions of TweenMax and ScrollTo. I switched them to 1.19 in your pen and it worked fine. Just make this adjustment and you should be good to go.
<script src="//cdnjs.cloudflare.com/ajax/libs/gsap/1.19.0/TweenMax.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/gsap/1.19.0/plugins/ScrollToPlugin.min.js"></script>

Happy tweening.

:)

  • Like 2
Link to comment
Share on other sites

 

Hi dwillis  :)
 
Looks like you're using older versions of TweenMax and ScrollTo. I switched them to 1.19 in your pen and it worked fine. Just make this adjustment and you should be good to go.
<script src="//cdnjs.cloudflare.com/ajax/libs/gsap/1.19.0/TweenMax.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/gsap/1.19.0/plugins/ScrollToPlugin.min.js"></script>

Happy tweening.

:)

 

 

Ah, I hadn't realized. I love an easy fix! Thank you!

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