javascript - touchstart event listener returning undefined -


code:

document.addeventlistener('touchstart', function(e) {     var ypos = e.screeny;     console.log(ypos); }); 

ypos returns undefined in console. have chekced previous answers cannot find solution. why ypos returning udefined , not y-coordinates of mouse?

any appreciated.

for single finger touch, need retrieve touch object e.touches[0].

e.touches (or e.changedtouches, e.targettouches) array, because spec supports multiple finger touch well.

once object, use either screenx/y, pagex/y, or clientx/y, defined in spec. however, browser implementations may still vary.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -