Share Posted April 9, 2015 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 More sharing options...
Share Posted April 9, 2015 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. 2 Link to comment Share on other sites More sharing options...
Author Share Posted April 9, 2015 ah data-clickable="true" I must have over looked that one. 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 More sharing options...
Share Posted April 9, 2015 You can set your edgeResistance a little lower, to like 0.99... or you could make an adjustment during onDrag onDrag: function(){ if (this.x >= this.minX) TweenLite.set(this.target, { x: this.minX + 3 }); } Link to comment Share on other sites More sharing options...
Author Share Posted April 9, 2015 that can work. getting weird results when setting autoScroll:1 it auto-scrolls to the right at times it goes beyond it's edgeResistance but has a hard time moving left. using same codepen. Link to comment Share on other sites More sharing options...
Share Posted April 10, 2015 Try making your #doc element bigger for the autoScroll to work. See the Pen MYMErE?editors=001 by osublake (@osublake) on CodePen Link to comment Share on other sites More sharing options...
Author Share Posted April 10, 2015 Thank you OSUBlake Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now