当前位置:网站首页>微信小程序 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元素获取焦点。
边栏推荐
- Ranking list of domestic databases in February, 2022: oceanbase regained the "three consecutive increases", and gaussdb is expected to achieve the largest increase this month
- 2.2 【pytorch】torchvision. transforms
- Shell script -if else statement
- Principle and application of single chip microcomputer timer, serial communication and interrupt system
- Common interview questions for embedded engineers 2-mcu_ STM32
- 【pytorch】nn.CrossEntropyLoss() 与 nn.NLLLoss()
- 通过 代码实例 理解 浅复制 与 深复制
- Shell script - string
- Is it safe to dig up money and make new shares
- It technology ebook collection
猜你喜欢

Why is the Ltd independent station a Web3.0 website!

3D printing Arduino four axis aircraft

nacos簡易實現負載均衡

【pytorch】nn. Crossentropyloss() and nn NLLLoss()

Pain points and solutions of equipment management in large factories

2.3 【pytorch】数据预处理 torchvision.datasets.ImageFolder

How to solve the problem of fixed assets management and inventory?

An overview of the design of royalties and service fees of mainstream NFT market platforms

【pytorch】nn.CrossEntropyLoss() 与 nn.NLLLoss()

小鸟识别APP
随机推荐
Shell script -for loop and for int loop
易点易动助力企业设备高效管理,提升设备利用率
How to solve the problem of fixed assets management and inventory?
[ESP nanny level tutorial] crazy completion chapter - Case: gy906 infrared temperature measurement access card swiping system based on the Internet of things
队列的实现和应用
Why is the Ltd independent station a Web3.0 website!
Shell脚本-特殊变量:Shell $#、$*、[email protected]、$?、$$
[pytorch learning] torch device
2.4 activation function
2.2 【pytorch】torchvision.transforms
Set the type of the input tag to number, and remove the up and down arrows
Football and basketball game score live broadcast platform source code /app development and construction project
Yidian Yidong helps enterprises to efficiently manage equipment and improve equipment utilization
Microcomputer principle - bus and its formation
How to effectively align team cognition
足球篮球体育比赛比分直播平台源码/app开发建设项目
【pytorch学习】torch.device
如何高效拉齐团队认知
R language observation log (part24) -- initialization settings
Installation and use of NoSQL database