JQuery UI Drag and Drop在ipad和iphone上的解决办法

安明亮
2023-12-01

JQuery UI的Drag and Drop插件可以很好的实现网页上的拖拽功能,但是在iPad和iPhone上似乎不能很好的支持,搜找了网上也有类似的问题,已经有解决办法。


1. 使用event.preventDefault()
    http://stackoverflow.com/questions/4488601/jquery-draggable-images-on-ipad-iphone-how-to-integrate-event-preventdefau/4488662#4488662

2. jquery-ui-touch-punch
    http://stackoverflow.com/questions/3279477/ipad-drag-and-drop

    1) Firstly, 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.
    http://touchpunch.furf.com/

    2) If you aren't using jQuery UI, use the fork I created https://github.com/mikeangstadt/jquery-ui-touch-punch.git to hook up touch handler's using jQuery by firing the already defined mouse events.

3. Mobile Drag and Drop
    http://www.stevefenton.co.uk/cmsfiles/assets/File/mobiledragdrop.html

4. jquery ui for ipad and iphone
    http://code.google.com/p/jquery-ui-for-ipad-and-iphone/

5. hammer.js
    https://github.com/EightMedia/hammer.js


另外 jQuery 也有 mobile 库 http://jquerymobile.com/ 或许对支持移动端的网页开发有用。

 类似资料: