如何让jQueryUI拖放到触摸设备上 [英] How to get jQueryUI drag\drop working with touch devices

查看:79
本文介绍了如何让jQueryUI拖放到触摸设备上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这种情况下,我希望有人回复告诉我我是个白痴.但是我仍然为jQueryUI拖放不适用于触摸设备而感到惊讶.我还没有对它们进行全部测试,但是在过去的一年中,我没有尝试过iphone \ ipad \ android 2、3& 4.刚刚在新的Android上尝试了最新版本.依然没有.不相信我,只需在移动设备上访问演示页面并尝试使用拖放示例即可.没事.

This is one situation where I hope someone replies to tell me I'm an idiot. But I continue to be amazed that jQueryUI drag\drop doesn't work with touch devices. I have not tested them all but I have tried iphone\ipad\android 2, 3&4 over the last year and nothing. Just tried the latest version on a new Android. Still nothing. Don't believe me, just visit the demo page on a mobile device and try to use the drag\drop examples. Nothing.

这里是否存在技术问题或核心不兼容?如此容易的修复程序,不值得写? jQuery开发人员不使用移动设备吗?我已经在Stack Overflow的各处看到了修复程序",但它们都是"hacks",我尝试过的所有方法都行不通.

Is there a technical problem or core incompatibility in play here? A fix so easy that its not worth writing about? Do jQuery devs not use mobile devices? I have seen "fixes" posted here and there around Stack Overflow but they are all "hacks" and all the ones I've tried don't work.

我很困惑.有人可以阐明这个问题吗?

I'm perplexed. Can someone shed some light on this issue?

推荐答案

如果只希望当前的jQuery UI代码可用于触摸事件,则可以使用

If you just want your current jQuery UI code to work with touch events, you can use the jQuery UI Touch Punch monkey patch.

唯一的技术问题或核心不兼容"是jQuery UI

The only "technical problem or core incompatibility" is that jQuery UI (1.x) only listens for mouse events, not touch events (See @ScottGonzales's response for the historical reason). jQuery touch punch, above, makes that change. You can even try some of the jQuery UI examples on that page, and they work. Generally, using Touch Punch is the currently accepted solution.

这篇关于如何让jQueryUI拖放到触摸设备上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆