指定区域滑动被禁用,无法触动移动端滑屏效果
$('.ruler ul').on("touchstart",function(e){
startY = e.originalEvent.changedTouches[0].pageY;
}
$('.ruler ul').on("touchmove",function(e){
moveY= e.originalEvent.changedTouches[0].pageY;
}
Y = moveY - startY; var scroll_offset = $('body,html').offset(); if(Y<0){ myscrollTop = $(window).scrollTop(); $('body').animate({ scrollTop:myscrollTop-Y+'px' //让body的scrollTop等于pos的top,就实现了滚动 },0); console.log(myscrollTop) }else{ myscrollTop = $(window).scrollTop(); $('body').animate({ scrollTop:myscrollTop-Y+'px' //让body的scrollTop等于pos的top,就实现了滚动 },0); }