Jump to content
Search Community

Draggable Children Click

NOEONE test
Moderator Tag

Go to solution Solved by OSUblake,

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

Hello I was wondering how I can click on children without firing onClick from draggable if child is clicked.

also how to prevent Draggable from firing click event if user swipes/drags outside of bounds the onClick event is dispatched.

 

MAC IOS Yosemite

Chrome: Version 41.0.2272.118 (64-bit)

See the Pen myZrVX by noeone (@noeone) on CodePen

Link to comment
Share on other sites

Your onClick is being dispatched when you drag outside of the bounds because you dragged your element to its maxX, and since it can't be dragged anymore, the minimumMovement requirement hasn't been met, so it's interpreted as a click. If this is an issue, you can change the edgeResistance to give it some wiggle room.

 

With your clickable children, are they supposed be draggable? If you don't want them to be draggble, you can add a data-clickable="true" attribute to prevent the draggable onClick from firing.

 

I guess it would be easier to understand if you could explain what the different clicks are supposed do, and how you want differentiate between them.

  • Like 2
Link to comment
Share on other sites

ah data-clickable="true" I must have over looked that one.  :oops:  works great! I was not planning on the inside children not to be draggable.

I was hoping for the draggable object not wiggle / snap or bounce when settingMovement:1 and for it not to trigger click, but if not possible not possible.

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