jquery-ui-touch-punch icon indicating copy to clipboard operation
jquery-ui-touch-punch copied to clipboard

No more Click events on Draggable "widgets"

Open marmz opened this issue 8 years ago • 4 comments

After including latest touch-punch release, draggable objects does not trigger any CLICK handler/callback. Fortunately, the fork by ivanmoralesv https://github.com/ivanmoralesv/jquery-ui-touch-punch seems to fix this particular issue, but i'm not sure that his branch is "aligned" with the newer modifications that could have been applied by the master developer (furf) ...

Maybe it could be useful to merge this "patch" into the original master branch, just to keep everything updated.

This is only an advice, of course ;)

marmz avatar Aug 25 '17 15:08 marmz

If I use ivan version, draggable stop working :-(

biafra avatar Nov 06 '17 23:11 biafra

This kind of problems are caused by event.preventDefault();. This line is not mobile friendly and need to be removed. The consequence is you need to analyse event.target in your code to conditionally call event.preventDefault();. Without event.preventDefault();, when you drag something, the default behavior of mobile screens is to move the whole viewport around. This is undesirable when you want to drag something on your mobile screen. There is no drop in solution for this problem. The only solution is to comment out the line event.preventDefault();, and conditionally call it in your code based on the result of event.target.

elgs avatar Feb 06 '18 06:02 elgs

in my usage i simply added somthing like this in the .min.js:

if(!$(a.target).hasClass('button') && !$(a.target).is("input") && !$(a.target).is("textarea") && !$(a.target).is("button")){a.preventDefault();}else{a.stopPropagation();}

so input,textarea and buttons work ... and when i give an element on the dragg a button class then it can be also clicked

schroedi23 avatar Aug 25 '18 17:08 schroedi23

Mine was still really iffy until I doubled dragIgnoreTime to 300. Now it's working much better in my case. Good fork

Committing avatar Dec 02 '22 20:12 Committing