i want to resize left panel element when the resize element is drag to the left or right... | Sololearn: Learn to code for FREE!
0

i want to resize left panel element when the resize element is drag to the left or right...

-my code works on my PC but won't work on chrome browser or on my phone... -Can anyone suggest another way of resizing the left panel when the the resize element is drag.. -my source code:https://code.sololearn.com/W1LQ3h33lvvy/?ref=app

16th Jul 2021, 1:03 PM
🤖Web Gig🤖
🤖Web Gig🤖 - avatar
3 Answers
+ 2
Add this event to your code: resize_el.addEventListener("touchmove", function(e){ let touch = e.targetTouches[0]; resize_el.style.left = touch.pageX-50+"px"; })
16th Jul 2021, 2:29 PM
Solo
Solo - avatar
+ 2
Pointer events are agnostic to device. Use it instead only mouse or touch type. https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events
16th Jul 2021, 2:41 PM
David Ordás
David Ordás - avatar
+ 1
The eventListener are only for mouse. Look up the ones for touch devices
16th Jul 2021, 1:50 PM
Hannes