Jump to content


Draggable trigger scroll from bounding box instead of mouse pointer

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

I'm using GreenSocks TweenMax and the Draggable plugin to move an element around. I also use the autoscroll feature to scroll the container when the mouse cursor is near the edges. 


How ever, I would prefer to trigger the scroll when the edges of the elements is near the scroll container instead of the mouse pointer. 


Is this possible?

Link to comment
Share on other sites

That's actually precisely how I originally built it, but then when I was testing it I realized it was quite unintuitive and felt "clunky" because it was too trigger-happy when dragging larger elements and it could even get into situations where it was logically impossible to manage, like if you tried dragging an element that was bigger than the scrollable area! In other words, both the top and the bottom would be close to (or exceeding) their respective edges, so it'd be wanting to scroll up and down at the same time. I even added logic to sense which direction the mouse had moved last so that I could discern the most likely way they wanted to go in that case, but even when that logic was working, it still just felt really weird and clunky from a practical standpoint. It's one of those things that **sounds** good in theory but then when you actually go to use it you realize it's riddled with problems. 


So I switched to using only the mouse as the indicator and it felt so much better and more natural. 


I guess the short answer is "no", that's not possible at this point :) 

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