Jump to content
GreenSock

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

Draggable onRelease method not fired

Recommended Posts

Hi guys!

 

I have the following problem: 

 

There is a draggable with attached methods onPress and onRelease. The draggable component has a button child. When I click on the draggable but outside of the button both events get fired. But when i click on the button only the onPress event gets fired (you can check this in the browser console). Same result happens if I put an input as a child and click on it.

 

Codepen: 

 

I need a way to fire both onPress and onRelease events when I click on buttons and inputs that are children of the draggable component.

 

Thanks in advance!

See the Pen jqqyEQ by anon (@anon) on CodePen

Link to comment
Share on other sites

Hi Koloff :)

 

pls add dragClickables : true to your Draggable create vars 

  • Like 1
Link to comment
Share on other sites

Thank you for the answer :) ! It worked well for buttons and links but now I can't use inputs and textareas because they don't get focused on click.

Link to comment
Share on other sites

i think that's better to check Draggable Doc. : http://greensock.com/docs/#/HTML5/Drag/Draggable/

 

as you can read in the Doc : 

 

dragClickables : Boolean - By default, Draggable will ignore clicks on <a>, <input> <select>,<button>, and <textarea> elements (as well as any element that has a data-clickable="true"attribute) , allowing the browser's default behavior (like clicking on an input would give it focus and drop the cursor there to begin typing), but if you want Draggable to hijack those clicks and initiate dragging instead, set dragClickables:true.

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