0
我正在使用xui-swipe.js
來檢測Phonegap應用程序上的左右手勢。xui輕掃手勢不能在真實設備上工作
它在Android模擬器和iPhone模擬器上工作正常。但是,當我將此應用程序安裝到真實設備(Samsung Glaxy S3)時,輕掃手勢僅檢測一次事件,之後沒有檢測到任何事件;無論是向左還是向右。
下面是用於檢測手勢代碼塊(注意,這兩個xui.js
和xui-swipe.js
包括):
<script type="application/javascript">
function init()
{
x$("#wrapper").swipe(function(e, data){
var offset = parseInt(sessionStorage.getItem('offset'));
switch(data.direction) {
case 'right':
if (offset>0) {
sessionStorage.setItem('offset', offset-1);
document.location = "file.html";
}
//alert('right');
break;
case 'left':
if (offset<10) {
sessionStorage.setItem('offset', offset+1);
document.location = "file.html";
}else {
document.location = "file-end.html";
}
//alert('left');
break;
}
}, {
swipeCapture: true,
longTapCapture: true,
doubleTapCapture: true,
simpleTapCapture: false
});
}
var _timer=setInterval(function(){
if(/loaded|complete/.test(document.readyState)){
clearInterval(_timer)
init() // call target function
}
}, 10);
</script>
任何幫助理解。