views:

820

answers:

2

I have a page that uses JQuery UI; in particular the Sortable interaction.

The page works fine for desktop web browsers with mice, however I can't get the drag-drop functionality to work on Mobile Safari on the iPhone. Any dragging action simply scrolls the page.

The functionality on my page is extremely similar to the Sortable Empty-Lists demo on the JQuery UI site. This page also doesn't work on the iPhone.

Is there any way to get the drag-drop functions working on the iPhone?

+3  A: 

According to the Mobile Safari docs drag and drop is not supported, but it can be simulated. Since basically dragging your finger along will scroll the browser you will have to disable this. That can be done like this:

$(document).bind('touchmove', function(e) {
   e.preventDefault();
}, false);

Otherwise the event you will have to handle are touchstart, touchmove and touchend.

Jakub Hampl
Thanks Jakub, Do you have a reference to the Mobile Safari docs?
Damovisa
http://developer.apple.com/safari/library/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW1 and around there.
Jakub Hampl
Awesome, thankyou!
Damovisa