Jump to content
GreenSock

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

Throwprops scroll bug?

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

Hey guys, long time no see :smile:

 

I'm getting back into GSAP and came across something that I think is a bug. I have a very basic container with substantial vertical padding that I'm trying to add `scrollTop` animation that uses GSAP's `throwProps` functionality. However, it seems to be breaking the scroll functionality, presumably due to the substantial vertical padding that I have. Note that you need to click/drag or touch/drag to have this behavior come into effect.

 

Am I doing something wrong or is this a bug?

 

P.S. How do I do inline code formatting in this editor?

See the Pen eamEzK by ZachSaucier (@ZachSaucier) on CodePen

Link to comment
Share on other sites

Hi @ZachSaucier,

 

I'm not 100% certain of the cause here, but setting a height on the .scroll-container seems to make everything work correctly.

 

See the Pen BeyJGd by PointC (@PointC) on CodePen

 

@GreenSock will probably stop by with more details. Happy tweening.

:)

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

37 minutes ago, PointC said:

I'm not 100% certain of the cause here, but setting a height on the .scroll-container seems to make everything work correctly.

 

Thanks a lot for the workaround, Craig! I suppose I should have played around with it some more. 

Link to comment
Share on other sites

No worries. I use Draggable quite a bit, but rarely use scrollTop so it took me a few minutes of tinkering too. :)

 

I'm sure Jack will stop by and drop some knowledge when he gets a chance.

 

Happy tweening.

:)

 

  • Like 1
Link to comment
Share on other sites

Adding `height: 0` causes an issue with the text being cut off part way up the page when text is partially on the page. It's related to the `calc(50vh - 1em)` statement because removing the `- 1em` fixes the issue (but isn't the effect I want). 

 

Hopefully there's a more satisfactory solution.

Link to comment
Share on other sites

Hey @ZachSaucier! Nice to see you around the neighborhood again. Sorry about my tardy response, but I think I got the Flu today and it completely wiped me out. 

 

Anyway, I might be misunderstanding your description of the problem, but from what I can tell it's working as I'd expect. You set it up to drag-scroll .scroll-container, but that doesn't have any scrolling at all. What you're seeing is the main page's (<body>) scroll bar. So dragging on .scroll-container shouldn't actually scroll the page. See what I mean? 

 

That's also why it worked if you set a height that's smaller than its natural height (thus, making it scrollable). 

 

Pardon my foggy brain, though, if I missed something obvious in my Flu-induced stupor. 

  • Like 2
Link to comment
Share on other sites

4 hours ago, GreenSock said:

Anyway, I might be misunderstanding your description of the problem, but from what I can tell it's working as I'd expect. You set it up to drag-scroll .scroll-container, but that doesn't have any scrolling at all. What you're seeing is the main page's (<body>) scroll bar. So dragging on .scroll-container shouldn't actually scroll the page. See what I mean? 

 

That makes a lot of sense. I am not sure why I didn't think of it that way in the first place. Setting height: 100vh in my situation is what I was wanting to do anyway. 

 

Thanks a lot for the help!

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

×