You can achieve that by First setting the boolean draggable to "true", though it may be true by default.
<div id="div1" draggable="true">
...I'll be making a code for this.
I have been playing with this couple of days ago, with html5 touch events for touchscreens and vanilla JS(no library), just made couple of changes. Ok here check it out:
@Visph, maybe that's because of your disapproving words against him ("Mmmm... Where is the code to study?")
...you don't need to find faults on someone's post only give your own suggestions and leave the rest to the asker.
@Calvin, I don't think it's a good motivation to leave the Q/A, just forget about this, dude! 😎
@Calvin wrote: << Here the code you could study... >>
Mmmm... Where is the code to study? You use only four lines of JS and the 'slip.js' library as linked file ;P
@Muhammad S U:
Here is the github project you could study...
And here the original demo page: