var lastY;//最后一次y坐標(biāo)點(diǎn)
$(document.body).on('touchstart', function(event) {
lastY = event.originalEvent.changedTouches[0].clientY;//點(diǎn)擊屏幕時記錄最后一次Y度坐標(biāo)。
});
$(document.body).on('touchmove', function(event) {
var y = event.originalEvent.changedTouches[0].clientY;
var st = $(this).scrollTop(); //滾動條高度
if (y >= lastY && st <= 10) {//如果滾動條高度小于0,可以理解為到頂了,且是下拉情況下,阻止touchmove事件。
lastY = y;
event.preventDefault();
}
lastY = y;
});
!評論內(nèi)容需包含中文