如何让 jQueryUI 拖放与触摸设备一起使用 [英] How to get jQueryUI dragdrop working with touch devices

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

问题描述

在这种情况下,我希望有人回复说我是个白痴.但我仍然感到惊讶的是 jQueryUI 拖放操作不适用于触摸设备.我还没有全部测试过,但我在去年尝试了 iphoneipadandroid 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 dragdrop doesn't work with touch devices. I have not tested them all but I have tried iphoneipadandroid 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 dragdrop examples. Nothing.

这里是否存在技术问题或核心不兼容问题?修复如此简单以至于不值得写?jQuery 开发人员不使用移动设备吗?我在 Stack Overflow 到处都看到过修复",但它们都是黑客",我尝试过的所有方法都不起作用.

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 代码处理触摸事件,你可以使用 jQuery UI Touch Punch 猴子补丁.

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 (1.x) 仅侦听鼠标事件,而不侦听触摸事件(有关历史原因,请参阅 @ScottGonzales 的响应).上面的 jQuery touch Punch 实现了这一改变.您甚至可以尝试该页面上的一些 jQuery UI 示例,它们都有效.通常,使用 Touch Punch 是目前公认的解决方案.

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天全站免登陆