views:

2282

answers:

2

Is it possible to allow users to drag and drop items in mobile safari? Google images on the iPhone does something similar, but I'm not sure if it is true drag and drop or some other work around. Anyone have any insights?

+1  A: 

In general, yes. Mobile Safari supports most of the standard mouse events for touches (as well as some specific touch-related events). Others, like mouseover, it doesn't support at all. You can get more specific information in the Safari Web Content Guide.

Sixten Otto
Check out Google Images on an iPhone or iTouch to see what I am talking about. They definitely allow you to "drag" images by dragging them to the left or right.
mazniak
They might be implementing it themselves with the usual mousedown/move/up events. Or they might be relying on the "panning" gesture described right at the beginning of the page I linked to (which generates scroll events). Either is definitely possible.
Sixten Otto
+6  A: 

Yes, it's possible. You have to disable the default of safari moving around. A few examples and links that might help you: http://tlrobinson.net/iphone/lighttable/ http://rossboucher.com/iphone/ http://rossboucher.com/2008/08/19/iphone-touch-events-in-javascript/

PanMan
Very interesting links. Thanks!
mazniak