三星S3向左滑动和向右滑动无法一按 [英] samsung S3 leftswipe and right swipe not working in one touch

查看:153
本文介绍了三星S3向左滑动和向右滑动无法一按的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用jquery mobile创建了一个移动应用程序,但一切正常,但在三星手机中向左滑动和向右滑动无法正常工作.

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.

滑动2-3次后即可正常工作.

its working after 2-3 swipe.

可以用

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.

注意:所有三星手机都存在问题,但我的要求仅适用于S3

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

推荐答案

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');
    }
});

在S3上选中.警报有效.

Checked on S3. Alert works.

这篇关于三星S3向左滑动和向右滑动无法一按的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆