UI的可拆卸和可排序功能在iPhone上运行

UI的可拆卸和可排序功能在iPhone上运行

本文介绍了如何让jQuery UI的可拆卸和可排序功能在iPhone上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用JQuery UI的页面;特别是互动。



页面适用于带有鼠标的桌面网络浏览器,但是我无法使用拖放功能在iPhone上使用移动Safari。任何拖动操作只需滚动页面。



我的页面上的功能非常类似于演示在JQuery UI网站上。这个页面在iPhone上也不起作用。



有没有办法让拖放功能在iPhone上工作?

解决方案

根据Mobile Safari文档拖放不支持,但可以进行模拟。因为基本上拖动你的手指会滚动浏览器,你必须禁用这个。可以这样做:

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

否则你必须处理的事件是 touchstart touchmove touchend


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?

解决方案

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.

这篇关于如何让jQuery UI的可拆卸和可排序功能在iPhone上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 12:50