Just set the class name in Javascript for draggable elements and use it in HTML elements with that class.
In this code, i have used class name as 'draggable'.
P.s :
For images, use pointer-events:none; in css to remove the default drag behaviour of browser.
If you have margins, make sure to make them to zero onmousemove function.
2 Responses