关于微信浏览器禁止下拉,但是里面的scroll可以滑动

岁月_Ben 2016-12-06 09:03:32
苹果机已经实现了这一效果,但是安卓机不行,,求大神们给予解决
var overscroll = function(el) {
el.addEventListener('touchstart', function() {
var top = el.scrollTop
, totalScroll = el.scrollHeight
, currentScroll = top + el.offsetHeight;
//If we're at the top or the bottom of the containers
//scroll, push up or down one pixel.
//
//this prevents the scroll from "passing through" to
//the body.
if(top === 0) {
el.scrollTop = 1;
} else if(currentScroll === totalScroll) {
el.scrollTop = top - 1;
}
});
el.addEventListener('touchmove', function(evt) {
//if the content is actually scrollable, i.e. the content is long enough
//that scrolling can occur
if(el.offsetHeight < el.scrollHeight)
evt._isScroller = true;
});
}
overscroll(document.querySelector('.scroll'));
document.body.addEventListener('touchmove', function(evt) {
//In this case, the default behavior is scrolling the body, which
//would result in an overflow. Since we don't want that, we preventDefault.
if(!evt._isScroller) {
evt.preventDefault();
}
});
...全文
2961 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
岁月_Ben 2017-03-07
  • 打赏
  • 举报
回复
引用 4 楼 xmt1139057136 的回复:
http://blog.csdn.net/u014620028/article/details/53285084 http://www.jb51.net/css/109928.html
还是步行的,这个一个是安卓开发的内容,一个是关于浏览器的问题,微信当跳出一个弹层内部滑动就不好整了
业余草 2017-03-07
  • 打赏
  • 举报
回复
效果图贴出来看看,没遇到过这种情况! 业余草 CODE大全 多百度百度!
岁月_Ben 2017-02-08
  • 打赏
  • 举报
回复
引用 2 楼 xmt1139057136 的回复:
https://segmentfault.com/q/1010000006943075/a-1020000006943646 http://blog.sina.com.cn/s/blog_721cd3390102vbpo.html 这个没用过!
不行呀,这个方法还是解决不了
岁月_Ben 2016-12-07
  • 打赏
  • 举报
回复
怎么没有人回答呢

39,084

社区成员

发帖
与我相关
我的任务
社区描述
HTML5是构建Web内容的一种语言描述方式。HTML5是互联网的下一代标准,是构建以及呈现互联网内容的一种语言方式.被认为是互联网的核心技术之一。
社区管理员
  • HTML5社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧