屏蔽ios弹性滑动

1

//判断手机类型
window.onload = function () {
 //alert($(window).height());
 var u = navigator.userAgent;
 if (u.indexOf('Android') > -1 || u.indexOf('Linux') > -1) {//安卓手机
 } else if (u.indexOf('iPhone') > -1) {//苹果手机
 //屏蔽ios下上下弹性
 $(window).on('scroll.elasticity', function (e) {
  e.preventDefault();
 }).on('touchmove.elasticity', function (e) {
  e.preventDefault();
 });
 } else if (u.indexOf('Windows Phone') > -1) {//winphone手机
 }
 //预加载
 loading();
}

2

$(window).on('scroll.elasticity', function (e) {
  e.preventDefault();
}).on('touchmove.elasticity', function (e) {
  e.preventDefault();
});

猜你喜欢

转载自blog.csdn.net/jiameng15/article/details/73826220