Jump to content
Search Community

Run function when dragger hits the start or the end of its boundary

scavaliere test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Hello everybody and happy new year! 
I am working on a Draggable which - basing on dragger position - changes a text inside a div. I would need to control this in two states: 

- hitting the left part of the boundaries (start position) -> change the text in "Open"
- hitting the right part of the boundary (end position) -> change the text in "Close"

I am using the hittest but I  am not very sure I need to bind to onDragEnd or something else and, anyway, it doesn't work correctly. 
I would need to change the text inside the div ONLY when the cursor hit the start or the end of its container. 

Anyone can help me to solve the problem? 

Thank you in advance!
 

See the Pen RwBorQY by scavaliere (@scavaliere) on CodePen

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