+ 2
Why is my code not working. I want to make a draggable div element using jQuery. I have linked all the required jQuery file.
2 ответов
+ 2
On Desktop your code works perfectly fine. You can drag the div using mouse. So I assume your problem is that it does not work for touch devices to drag the div. It seems that jQuery does not fully support touch events. By adding some js code to replace the touch events by mouse events which I found here:
https://stackoverflow.com/questions/1517924/javascript-mapping-touch-events-to-mouse-events
it is possible to achieve a touch draggable div element:
Note though that this is a bit hacky and won't necessarily work under all circumstances.
https://code.sololearn.com/W4A209A2255a/?ref=app
+ 1
Hape thank you , yes it was working on desktop .