0

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

supersaiyan
  • 1,670
  • 5
  • 16
  • 36

1 Answers1

2
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.

Alex
  • 11,115
  • 12
  • 51
  • 64