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

python - Installing PyDev in eclipse is failed -

PHP OOP-based login system -

c# - Nested Internal Class with Readonly Hashtable throws Null ref exception.. on assignment -