+ 2

Touchmove event on parentNode

The first and the second divs are identical except the second div has children elements. How can I make the second div still dragable despite the children nodes? https://code.sololearn.com/WBsydOko1ozF/?ref=app

1st Nov 2018, 7:41 PM
Fernando Moceces
Fernando Moceces - avatar
6 ответов
+ 3
Or changing how touchmove event is handled in Section.. Replace with: Second.addEventListener('touchmove', function(ev){ touch=ev.targetTouches[0]; ev.currentTarget.style.left=touch.pageX-50+"px"; ev.currentTarget.style.top=touch.pageY-50+"px"; ev.stopPropagation() }, true) If you dont know why it work in this way, i can point you to some explaination
1st Nov 2018, 11:15 PM
KrOW
KrOW - avatar
+ 3
Hey, i used a psuedo element to, make it draggable. the problem was the children were preventing you to be able to actually touch the second element. https://code.sololearn.com/WVh0LPzUD0G7/?ref=app
1st Nov 2018, 8:33 PM
xpnvdo
xpnvdo - avatar
+ 3
<resolved> looks like Good answer xp nvdo
1st Nov 2018, 10:01 PM
BroFar
BroFar - avatar
+ 3
Thank you, xp nvdo ! Never would have thought that messing with the css could be an option to solve it :) Super awesome, KrOW, thank you! For now I'm pretty satisfied with the fact that replacing "target" by "currentTarget" solves it :)
2nd Nov 2018, 3:25 AM
Fernando Moceces
Fernando Moceces - avatar
+ 1
thanks. 👍
1st Nov 2018, 10:02 PM
xpnvdo
xpnvdo - avatar
+ 1
Fernando Moceces Its not currentTarget only that solve the problem 😉. Anyway, you are welcome 👍👍👍
2nd Nov 2018, 6:02 AM
KrOW
KrOW - avatar