+ 4
How to make the scrolling on app not awkward?
I have the problem that when I have a code (most of the time in games) where the player needs to move the finger on the screen to do something, the entire screen moves. I have solved that with CSS now but it's still awkward, since the coordinates of the touch event are off and kind of messing me up... In this code it becomes quite apparent when you try to go up and down without letting the finger go: https://code.sololearn.com/W6qzpzgF5Qac/?ref=app Hope somebody can help me...
5 Respuestas
+ 6
Aha! If I change lines 51 and 52 to:
var x = (e.clientX || e.targetTouches[0].clientX) - 10;
var y = (e.clientY || e.targetTouches[0].clientY) - 90;
And I add in the CSS:
html { position: fixed; }
Then it works for me!
+ 6
You need to set html { position: fixed; } and it should work.
+ 4
Hmm... that’s really strange. It doesn’t happen in my code, but it does on yours. Sorry, I don’t know how to fix this.
+ 1
Rowsej , Idid that already but the coordinates of the touchevent aren't the ones you would expect.
it's when you go up the effectivness of going up decreses the higher you go.
... 😅
+ 1
now it works, sorry I didn't notice that you anwsered ... 😅