mobile - javascript mousedown event location on windows phone -
i creating mobile site needs cross browser compatable. 1 feature need detect location of touch event.
windows phone not support touchstart etc. using mousedown instead, having trouble getting page position event. works without issue on desktop, , mousedown being detected on windows phone, can't figure out how offsetx - offset y.
heres sample works on desktop , on iphone , android (i using jquery no plugins or non-standard):
$("div").on("touchstart mousedown", function(e){ org_x = e.originalevent.changedtouches[0].pagex ? e.originalevent.changedtouches[0].pagex : e.originalevent.offsetx; alert(org_x); org_y = e.originalevent.changedtouches[0].pagey ? e.originalevent.changedtouches[0].pagey : e.originalevent.offsety; alert(org_y); }); i have tested on windows phone 8 , 9
try code ,it work fine
document.getelementbyid("clickdiv").addeventlistener("mspointerdown",handledown,false); function handledown(evt) { alert(evt.originalevent.layerx); } $("#clickdivalt").on("mspointerdown", handlealtdown); function handlealtdown(evt){ alert(evt.originalevent.layerx); }
Comments
Post a Comment