我正在使用 jQuery mobile 1.3.2,并为滑动事件添加了钩子。对于每个滑动事件,我都在向左/向右滑动 note_container。然而,滑动事件的注册在三星 Galaxy S3(和其他安卓设备)上是间歇性的/没有响应,但在 iPhone 上运行良好。有什么特别的原因吗?
<html>
<head>
<meta charset="utf-8" />
<title>Notoji</title>
<meta name="viewport" content="width=device-width, user-scalable=no"/>
<link rel="stylesheet" type="text/css" href="css/main.css"/>
<link rel="stylesheet" type="text/css" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.css"/>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.js"></script>
<script>
$(document).ready(function(){
width = $('.note').first().width();
$('.note_container').bind('swipeleft', swipe_note_left);
$('.note_container').bind('swiperight', swipe_note_right);
function swipe_note_left(){
alert("left swiped");
left_val = $('.note_container').offset().left;
adjusted_left = left_val - width;
$('.note_container').animate({left: adjusted_left, useTranslate3d:true}, 250);
}
function swipe_note_right(){
alert('right swiped');
left_val = $('.note_container').offset().left;
adjusted_left = left_val + width;
$('.note_container').animate({left: adjusted_left, useTranslate3d:true}, 250);
}
})
</script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<div class="title"> Notoji</div>
</div>
<div data-role="content" class="content review">
<div class="note_container">
<div class="note">
<div class="note_text">Its my birthday, and I have treated myself to a very nice gift.</div>
<img class="sticker" src="/assets/sally/sally_04.png"/>
</div>
<div class="note">
<div class="note_text">The rogue defender. Killer the wrestler bunny.</div>
<img class="sticker" src="/assets/killer/killer_01.png"/>
</div>
</div>
<a href="create.html" data-transition="slideup" data-inline="true">
<span class="create"></span>
</a>
</span>
</div>
</div>
</body>
您可以在这里测试代码:http: //jsbin.com/UPoparU/1/