我们可以为移动视图实现带触摸事件的Drag n Drop吗? [英] Can we implement Drag n Drop with touch events for mobile view?
问题描述
我正在使用简单的HTML-5,并在React JS中使用Drag n Drop功能,而没有任何库。我已经在网络上实施了该软件,但是效果很好,但是当我使用移动设备时却无法使用。有触摸事件可以处理移动设备的触摸问题,但是我没有实现任何解决方案。请推荐一些效果很好的东西。
I am using simple HTML-5, and using Drag n Drop feature in React JS, without any library. I have implemented on web, it's working good but when i come to mobile it doesn't work. There are touch events to handle touch things for mobile but i am not achieve any solution. Please recommend some thing which works well.
推荐答案
在移动设备上模拟HTML5拖放的填充程序库很少。
There are few shim libs that emulate HTML5 drag and drop on mobile devices.
示例: DragDropTouch
通常会克隆您尝试在 touchstart
上拖动的元素,复制所有样式并将其放到正文中,之后 touchmove
他们更改该元素的位置并模拟拖动事件
They usually clone element that you try to drag on touchstart
, copy all styles and put it to body, after that on touchmove
they change position of this element and emulate drag events
在模拟本地拖放操作时,我所做的同样 dragee 。在移动设备上可以正常工作并支持多点触控
The same I do when emulate native drag&drop inside dragee. It's work good on mobile devices as was developed to work on them and support multi touches
这篇关于我们可以为移动视图实现带触摸事件的Drag n Drop吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!