Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

enabling drag and drop on a touchscreen mobile device

I just recently got an android phone and found that the drag and drop on my site doesn't work! I understand why it wouldn't, but has anyone found a solution to this? I'm using JQuery to implement the D & D...

like image 984
danwoods Avatar asked Jan 09 '10 18:01

danwoods


People also ask

How do you drag and drop on a touch screen?

To drag. Put a finger on the desired point on the touch screen and slide the finger.

Does drag and drop work on mobile?

The Android drag and drop framework enables you to add interactive drag and drop capabilities to your app. With drag and drop, users can copy or move text, images, objects—any content that can be represented by a URI—from one View to another within an app or, in multi-window mode, between apps.


2 Answers

I used jQuery UI touch punch - it works by hacking the mousedown, mouseup features and replaces them with touchstart, touchend etc.

ABOUT: http://touchpunch.furf.com/

SCRIPT: https://raw.github.com/furf/jquery-ui-touch-punch/master/jquery.ui.touch-punch.min.js

CODE:

include:

<script src="jquery.ui.touch-punch.min.js"></script>

after your jquery UI script file in your header.

like image 182
Jonathan Tonge Avatar answered Oct 22 '22 08:10

Jonathan Tonge


I used the touchpunch answer above and it worked great. One note on it, though. I found that using the github link on the site (and above):

SCRIPT: https://raw.github.com/furf/jquery-ui-touch-punch/master/jquery.ui.touch-punch.min.js

did not work for Android devices running mobile Chrome, but the raw, human readable source from the site did work. This is as of the date of this posting, it may get fixed of course, but in the mean time maybe it will save you a few cycles of debugging.

like image 20
ajl Avatar answered Oct 22 '22 09:10

ajl