HTML Drag And Drop On Mobile Devices

Fenton picture Fenton · Jul 3, 2010 · Viewed 131.2k times · Source

When you add drag and drop to a web page using JavaScript, such as jQuery UI draggable and droppable, how do you get this to work when viewed via a browser on a mobile device - where the touch-screen actions for dragging are intercepted by the phone for scrolling around the page etc?

All solutions welcome... my initial thoughts are:

  1. Have a button for mobile devices that "lifts" the item to be dragged and then get them to click the zone they want to drop the item on.

  2. Write an app that does this for mobile devices rather then try and get the web page to work on them!

  3. Your suggestions and comments please.

Answer

vichsu picture vichsu · May 11, 2012

jQuery UI Touch Punch just solves it all.

It's a Touch Event Support for jQuery UI. Basically, it just wires touch event back to jQuery UI. Tested on iPad, iPhone, Android and other touch-enabled mobile devices. I used jQuery UI sortable and it works like a charm.

http://touchpunch.furf.com/