samsung S3 leftswipe and right swipe not working in one touch

拟墨画扇 提交于 2019-12-11 21:21:03

问题


i created one mobile app with jquery mobile everything is working fine but in samsung phones left swipe and right swipe is not working properly.

its working after 2-3 swipe.

it can be handled with

var startCoords;
        $(document.body).on("touchstart", function(event) {
            startCoords = event.originalEvent.targetTouches[0];
        });

        document.addEventListener('touchmove', function(e) {
            var touchmoveEvent = e.touches[0];
            if(touchmoveEvent.pageX && Math.abs(startCoords.pageX - touchmoveEvent.pageX) > 10)
                e.preventDefault();
        }, false);

But if i am adding this code zoom and pinch is not working... any pointer to fix this problem will be very helpful.

note : problem in all samsung phone but my requirment is for S3 only


回答1:


var startCoords;
$(document).on("touchstart", function(event) {
    startCoords = event.originalEvent.touches[0];
}).on('touchmove', function(event) {
    var endCoords = event.originalEvent.touches[0];
    if(Math.abs(startCoords.pageX - endCoords.pageX) > 10) {
        alert('Swipe event');
    }
});

Checked on S3. Alert works.



来源:https://stackoverflow.com/questions/19740345/samsung-s3-leftswipe-and-right-swipe-not-working-in-one-touch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!