jQuery ipad拖放

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3279477/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 15:10:11  来源:igfitidea点击:

ipad drag and drop

jqueryipad

提问by Dejell

I need to implement drag and drop for Ipad.

我需要为 Ipad 实现拖放。

I tried this solution: http://www.gotproject.com/blog/post2.html

我试过这个解决方案:http: //www.gotproject.com/blog/post2.html

But since I am using JQuery myself, it conflicts and does not work.

但是由于我自己使用的是 JQuery,它会发生冲突并且不起作用。

How can I use JQuery drag and drop for IPad?

如何在 iPad 上使用 JQuery 拖放功能?

采纳答案by Michael Angstadt

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

如果您不使用 jQuery UI,请使用我创建的分支https://github.com/mikeangstadt/jquery-ui-touch-punch.git通过触发已定义的鼠标事件来使用 jQuery 连接触摸处理程序。

Works well on iOS6, haven't tested for Android or others.

在 iOS6 上运行良好,尚未针对 Android 或其他系统进行测试。

回答by Mandeep Pasbola

Working :

在职的 :

Firstly, use jquery UI http://jqueryui.com/demos/for drag and drop functionality

首先,使用 jquery UI http://jqueryui.com/demos/实现拖放功能

and then add this script https://github.com/furf/jquery-ui-touch-punchfor playing it in Ipad or Iphone.

然后添加此脚本https://github.com/furf/jquery-ui-touch-punch以在 Ipad 或 Iphone 中播放。

Hope it helps.

希望能帮助到你。

回答by Steve Meisner

Apple has a Section called "Handling Multi-Touch Events" here: https://developer.apple.com/library/content/documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/multitouch_background/multitouch_background.html

Apple 在此处有一个名为“处理多点触控事件”的部分:https: //developer.apple.com/library/content/documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/multitouch_background/multitouch_background.html

It is the official Apple guide on how you can handle almost all of your touch events with the standard controls and gesture recognizers in UIKit.

它是关于如何使用 UIKit 中的标准控件和手势识别器处理几乎所有触摸事件的 Apple 官方指南。

回答by doctorme

Confirmed that furf's jquery-ui-touch-punch works on the iPad.

确认 furf 的 jquery-ui-touch-punch 在 iPad 上工作。

Getting it to work is as easy as including "jquery.ui.touch-punch.js" after you've included jquery-ui and jquery itself. For example:

让它工作就像在包含 jquery-ui 和 jquery 本身之后包含“jquery.ui.touch-punch.js”一样简单。例如:

HTML:

HTML:

<head>
    <script type="text/javascript" src="js/jquery.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.8.17.custom.min.js"></script>

    <!-- touch capability for tablets/phones -->
    <script type="text/javascript" src="js/jquery.ui.touch-punch.js"></script>
</head>

Javascript:

Javascript:

//
// assume that html_string is a valid string
// containing some element you want to be draggable
// which needs to be added to the DOM
//
function addItemToUIList (list, html_string) {
    var item = $(list).append (html_string);

    // now, using jqui and touch-punch, we can make it draggable
    item.draggable ();
}

Now "item" can be dragged around on screen on the ipad as well as in chrome on the desktop.

现在“项目”可以在 ipad 的屏幕上以及桌面上的 chrome 中拖动。

回答by Youry

I have worked on a fix to this issue check my github: https://github.com/youryss/fixdragtablet

我已经解决了这个问题,请检查我的 github:https: //github.com/youryss/fixdragtablet

I hope it works for you

我希望这个对你有用