Can we implement Drag n Drop with touch events for mobile view?

不打扰是莪最后的温柔 提交于 2020-01-25 03:54:29

问题


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.


回答1:


There are few shim libs that emulate HTML5 drag and drop on mobile devices.

Example: DragDropTouch

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

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



来源:https://stackoverflow.com/questions/58389448/can-we-implement-drag-n-drop-with-touch-events-for-mobile-view

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!