Can someone please explain to me how the drag and drop API works. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 15

Can someone please explain to me how the drag and drop API works.

If you can, share a code showing it.

8th Jul 2017, 10:36 PM
Kabulput
Kabulput - avatar
10 Answers
+ 5
You can achieve that by First setting the boolean draggable to "true", though it may be true by default. eg: <div id="div1" draggable="true"> then the JavaScript code for the ondrag event function. ...I'll be making a code for this.
8th Jul 2017, 10:46 PM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
+ 14
Thank you, looking forward to the code.
8th Jul 2017, 10:54 PM
Kabulput
Kabulput - avatar
+ 12
Thank you guys 😃
9th Jul 2017, 8:06 AM
Kabulput
Kabulput - avatar
+ 6
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: https://code.sololearn.com/Wdhhd3yG5Z7l/?ref=app
9th Jul 2017, 6:42 AM
Benneth Yankey
Benneth Yankey - avatar
+ 6
@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! 😎
9th Jul 2017, 8:46 AM
Nomeh Uchenna Gabriel
Nomeh Uchenna Gabriel - avatar
+ 6
My examination is near. Can't Q&A later.
9th Jul 2017, 8:50 AM
Calviղ
Calviղ - avatar
+ 5
Here the code you could study... https://code.sololearn.com/WgZg39ucD3l4/?ref=app
9th Jul 2017, 3:42 AM
Calviղ
Calviղ - avatar
+ 5
Thank you @visph for all the clarifications. ;P Happy coding, everyone. Calvin is signing off from Q&A here.
9th Jul 2017, 8:32 AM
Calviղ
Calviղ - avatar
+ 4
@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... https://github.com/pornel/slip And here the original demo page: https://kornel.ski/slip/
9th Jul 2017, 6:28 AM
visph
visph - avatar
+ 3
@Calvin wrote: << Calvin is signing off from Q&A here. >> Why signing off? Can we be complementary all together in our answers? ;)
9th Jul 2017, 8:38 AM
visph
visph - avatar