2013-11-02 31 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