解决方案1:
<script type="text/javascript">
document.body.addEventListener('touchstart', function() {
var top = document.body.scrollTop
,totalScroll = document.body.scrollHeight
,currentScroll = top + document.body.offsetHeight;
if(top === 0) {
document.body.scrollTop = 1;
}else if(currentScroll === totalScroll) {
document.body.scrollTop = top - 1;
}
});
document.body.addEventListener('touchmove', function(evt) {
if(document.body.offsetHeight < document.body.scrollHeight)
evt._isScroller = true;
});
document.body.addEventListener('touchmove', function(evt) {
if(!evt._isScroller) {
evt.preventDefault();
}
});
//禁止默认滑动函数
function handler(){
event.preventDefault();
}
document.addEventListener("touchmove",function(e){
document.removeEventListener('touchmove', handler, false);
});
</script>
2:
给定div固定高度,加载完后jq修改css值
ios手机浏览器下拉上滑空白
最新推荐文章于 2022-07-05 13:54:37 发布