我遇到iPhone问题并刷到其他页面.向下滚动页面时,动作的灵敏度很敏感,并将滑动到下一页.有没有办法控制此代码中的滑动敏感度:
<script type="text/javascript"> $(document).ready(function(){ var counter = 1; $(document).bind('swipeleft','#deal_1',function (event,ui) { counter++; if(counter>3) counter = 1; var nextpage = 'dailydeal'+counter+'.html'; if (nextpage.length > 0) { $.mobile.changePage(nextpage,{transition: "slide",reverse: false},true,true); } }); $(document).bind('swiperight',ui) { counter--; if(counter<1) counter=3; var prevpage = 'dailydeal'+counter+'.html'; if (prevpage.length > 0) { $.mobile.changePage(prevpage,reverse: true},true); } }); }); </script>
解决方法
为了定制对所有设备的响应,我建议设置相对于屏幕宽度的阈值.例如:
$.event.special.swipe.scrollSupressionThreshold = (screen.availWidth) / 60; $.event.special.swipe.horizontalDistanceThreshold = (screen.availWidth) / 60; $.event.special.swipe.verticalDistanceThreshold = (screen.availHeight) / 13;