微信H5页面禁止下拉露出网页来源

可将position设置为fixed;其就不会上下滑动。
1.可以给document的touchmove事件禁止掉就行了

  1. document.querySelector('body').addEventListener('touchmove', function(e) {
  2. e.preventDefault();
  3. })

2.如果页面有部分区域必须需要滑动,需要用touchmove事件的话,那么可以把那部分的touchmove事件过滤掉
比如我想要以下代码中的bottom类可以用touchmove事件

  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>微信禁止下拉露黑底</title>
  6. </head>
  7. <body>
  8. <div class="top"></div>
  9. <div class="bottom"></div>
  10. </body>
  11. </html>

用以下代码就可以实现

  1. document.querySelector('body').addEventListener('touchmove', function(e) {
  2. if (!document.querySelector('.bottom').contains(e.target)) {
  3. e.preventDefault();
  4. }
  5. })
技术文档

苹果maccms v8二次开发邀请码注册功能

2018-2-26 23:14:54

技术文档

Nginx屏蔽或禁止指定来源网站访问

2018-6-7 19:07:16

0 条回复 A文章作者 M管理员
欢迎您,新朋友,感谢参与互动!
    暂无讨论,说说你的看法吧
个人中心
私信列表
搜索