How Do You Drag A Picture | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How Do You Drag A Picture

How Do I Make A Picture Draggable Using The <img src="(picture URL)"> tag?

14th Sep 2017, 3:40 AM
Youssef Samir Hamid
Youssef Samir Hamid - avatar
6 Answers
14th Sep 2017, 3:52 AM
Calviղ
Calviղ - avatar
+ 3
The draggable attribute does not work as expected on SoloLearn... but I was able to get the event to fire. https://code.sololearn.com/Wj6fxaYu736Z/?ref=app Tap and hold to see the alert -- which (if you hide the alert) may result in a browser starting true dragging. In the app, I think you'll have to implement the drag by hand. This is private / unfinished; it's one of my 'just checking' codes. edit: If you follow the link I kept for myself, it leads to an answer with draggable squares (it's using ES6 syntax): https://code.sololearn.com/Wdhhd3yG5Z7l/?ref=app
14th Sep 2017, 4:49 AM
Kirk Schafer
Kirk Schafer - avatar
+ 1
#Youssef You can use only touchmove event to move an image. That's the most simpler method.
14th Sep 2017, 5:29 AM
Calviղ
Calviղ - avatar
+ 1
touchmove event triggered when the touched element is being moved.
14th Sep 2017, 1:14 PM
Calviղ
Calviղ - avatar
0
@Calvin is there anything simpler?
14th Sep 2017, 3:56 AM
Youssef Samir Hamid
Youssef Samir Hamid - avatar
0
@Calvin And What Is The Tag Of Touchmove?
14th Sep 2017, 1:09 PM
Youssef Samir Hamid
Youssef Samir Hamid - avatar