问题
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