I am coding a webpage to be viewed on iPad. It uses Safaris/Webkits drag & drop. I have exactly copied Safari's example drag & drop code but it wont work.
My Problem: The ondrop event is never triggered when I run the webpage(HTML, CSS & Javascript) on Safari Desktop or on Safari on an iPad. On ipad I cannot even drag the elements(the microscope thingie appears & it wont drag when I hold & move my finger over the element). The drag does work on desktop though.
Whats going wrong?
The small code example can be found at the very bottom of this page: http://developer.apple.com/library/safari/#documentation/appleapplications/Conceptual/SafariJSProgTopics/Tasks/DragAndDrop.html
Here is the JSFiddle (remember the drag & drop is Webkit so only for Safari-this webpage is for ipad only): http://jsfiddle.net/eyM3y/
Source: Tips4all, CCNA FINAL EXAM
Working alternative :
ReplyDeleteFirstly, use jquery UI http://jqueryui.com/demos/ for drag and drop functionality
and then add this script https://github.com/furf/jquery-ui-touch-punch for playing it in Ipad or Iphone.
Hope it helps.
I had a similar issue with one of my project but it can be resolved by following tutorial: http://popdevelop.com/2010/08/touching-the-web/ . It works for me I hope you will like it.
ReplyDeleteDid you read the top of the page you linked to in Apple's documentation? It says:
ReplyDeleteNote: This technology is supported only on desktop versions of Safari. For iOS, use DOM Touch, described in Handling Events (part of Safari Web Content Guide) and Safari DOM Additions Reference.
DOM Touch link
Safari DOM Additions link
I believe you may want to listen for the touchmove and touchend events instead of on drag and on drop. :)