HTML Drag And Drop On Mobile Devices

后端 未结 8 977
栀梦
栀梦 2020-11-29 16:28

When you add drag and drop to a web page using JavaScript, such as jQuery UI draggable and droppable, how do you get this to work when viewed via a browser on a mobile devic

8条回答
  •  一生所求
    2020-11-29 16:48

    You might as well give a try to Tim Ruffle's drag-n-drop polyfill, certainly similar to Bernardo Castilho's one (see @remdevtec answer).

    Simply do npm install mobile-drag-drop --save (other installation methods available, e.g. with bower)

    Then, any element interface relying on touch detection should work on mobile (e.g. dragging only an element, instead of scrolling + dragging at the same time).

提交回复
热议问题