Jump to content

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

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: https://codepen.io/anon/pen/jqqyEQ


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!

Share this post

Link to post
Share on other sites

Hi Koloff :)


pls add dragClickables : true to your Draggable create vars 

  • Like 1

Share this post

Link to post
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.

Share this post

Link to post
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

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.