Freckles Posted June 26, 2020 Share Posted June 26, 2020 I have this line "window.addEventListener('click', overBack);" which works perfectly. When having "window.on('click', overBack)" window is undefined, so I left the first option. But the problem is that "window.addEventListener('tap', overBack);" doesn't do the job. I've tried to replace window with page and screen and it didn't work. So I thought you might help me. How do I refer to the window/screen? Thanks in advance Quote Link to comment Share on other sites More sharing options...
jonforum Posted June 26, 2020 Share Posted June 26, 2020 did you try `documents.addEventListener` ? Quote Link to comment Share on other sites More sharing options...
Freckles Posted June 29, 2020 Author Share Posted June 29, 2020 (edited) @jonforum I tried `document.addEventListener('tap', overBack)` and it didn't work for mobile though with 'click' event it works for web. edit: the problem was that I used event.pageX in overBack function which is undefined on mobile. I changed it to event.touches[0].pageX and it worked. I should've checked that earlier) Edited June 29, 2020 by Freckles Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.