当前位置:网站首页>微信小程序 webview 禁止页面滚动,同时又不影响业务内overflow的滚动的实现方式
微信小程序 webview 禁止页面滚动,同时又不影响业务内overflow的滚动的实现方式
2022-07-01 09:08:00 【你的长情呢~】
html,body{
position: fixed;
top:0;
left:0;
height: 100vh;
overflow: scroll;
}
实现方式超级简单,但是我调了好多次都没有实现效果,研究了半天发现是页面缓存的问题,于是在head标签内加载css文件的时候改成了以下写法
<link type="text/css" rel="stylesheet" href="css/page.css?t=<?=filemtime("css/style.css")?>">
====================================
2020年6月28日 16:03:03 修改
上面的做法或许是可以实现的,但是在某些情况下导致业务内的滑动也失效。今天又研究了一套做法就是。
.bg {
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
overflow: auto;
background-color: #fff;
}
<script type="text/javascript">
setInterval(function () {
$(".bg").focus();
console.log(1);
}, 500);
</script>
解释一下,我理解的应该也不是完全正确的 就是 css样式可以实现想要的效果,但是偶尔页面上需要滑动的dom会失焦,导致无法滑动,此时可以用js定时器给这个dom元素获取焦点。
边栏推荐
- MySQL optimization
- Record a redis timeout
- 2.3 [pytorch] data preprocessing torchvision datasets. ImageFolder
- NoSQL数据库的安装和使用
- 小鸟识别APP
- Phishing identification app
- tensorrt yolov5_ trt. Py comments
- R language observation log (part24) -- initialization settings
- Redis -- lattice connects to redis cluster
- [ESP nanny level tutorial] crazy completion chapter - Case: ws2812 light control system based on Alibaba cloud, applet and Arduino
猜你喜欢

TV size and viewing distance

Daily practice of C language - day 80: currency change

如何一站式高效管理固定资产?

NiO zero copy

Vsync+ triple cache mechanism +choreographer

Redis -- lattice connects to redis cluster

【pytorch】2.4 卷积函数 nn.conv2d

FreeRTOS learning easy notes

Imitation of Baidu search results top navigation bar effect

树结构---二叉树2非递归遍历
随机推荐
MySQL optimization
nacos服务配置和持久化配置
Vsync+ triple cache mechanism +choreographer
Shell script -select in loop
Summary of reptile knowledge points
安装Oracle EE
Shell script -if else statement
2.3 【pytorch】数据预处理 torchvision.datasets.ImageFolder
序列化、监听、自定义注解
【ESP 保姆级教程】疯狂毕设篇 —— 案例:基于阿里云、小程序、Arduino的WS2812灯控系统
The jar package embedded with SQLite database is deployed by changing directories on the same machine, and the newly added database records are gone
Football and basketball game score live broadcast platform source code /app development and construction project
In the middle of the year, where should fixed asset management go?
[ESP nanny level tutorial preview] crazy node JS server - Case: esp8266 + DHT11 +nodejs local service + MySQL database
What are the differences between the architecture a, R and m of arm V7, and in which fields are they applied?
Shell脚本-while循环详解
NoSQL数据库的安装和使用
Shell脚本-数组定义以及获取数组元素
Shell script echo command escape character
Naoqi robot summary 28