2013-11-02 32 views
0

我创建了一个移动应用程序与jquery移动一切工作正常,但在三星手机左侧刷卡和右侧刷卡不能正常工作。三星S3 leftswipe和右刷卡不工作在一个触摸

其2-3工作后刷卡。

它可以与

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

处理,但如果我加入这个代码变焦和捏不工作...任何指针来解决这个问题将是非常有益的。

注:在所有的三星手机的问题,但我的需求量的是S3仅

回答

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

经过上S3。警报有效。

+0

我没有得到请帮我解释或任何工作的例子或小提琴? – supersaiyan

+0

编辑我的代码示例,并在s3上检查它。有用。 – Pinal

+0

或者试试https://github.com/stephband/jquery.event.swipe – Pinal