0

I am creating a mobile site that needs to be cross browser compatible. For one feature I need to detect the location of a touch event.

Windows Phone does not support touchstart etc. so I am using mousedown instead, but I am having trouble getting the page position from the event. It works without issue on desktop, and the mousedown is being detected on windows phone, but I can't figure out how to get the offsetX - offset Y.

Here's a sample which works on desktop and on iPhone and android (I am using jQuery but no plugins or anything 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 this on windows phone 8 and 9

4

3 に答える 3

0

私が見たものから、あなたはこの記事を読みたいと思っています:モバイルデバイスでのタッチ/ジェスチャー、またはこのスタックオーバーフローの質問を見てください: Windows phone 8 タッチサポート

私はまだ矢印を探しており、見つけ次第、より良い解決策で回答を更新します!

于 2013-05-03T13:55:47.633 に答える