gpt4 book ai didi

html - Safari - IPAD - 在没有 -webkit-overflow-scrolling 的情况下禁用弹跳(无滚动)

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:07:09 25 4
gpt4 key购买 nike

首先,我在网络上测试了很多解决方案,但所有解决方案都行不通。

我有一个带有 Iframe 的网页,其中一个 div 带有 overflow:hidden 和一个 div 带有 overflow:滚动

当我想滚动到包含在 Iframe 中的 div 时,反弹打破了一切。每次滚动后出现弹跳,内容一点点出现。

我想禁用弹跳而不是滚动。我不想使用 -webkit-overflow-scrolling。因为应用了-webkit-overflow-scrolling之后,我页面的overflow都是overflow:auto,对我来说不是什么好办法吗

我已经尝试过这个解决方案,但效果不佳且无法滚动:

var xStart, yStart = 0;

document.addEventListener('touchstart',function(e) {
xStart = e.touches[0].screenX;
yStart = e.touches[0].screenY;
});

document.addEventListener('touchmove',function(e) {
var xMovement = Math.abs(e.touches[0].screenX - xStart);
var yMovement = Math.abs(e.touches[0].screenY - yStart);
if((yMovement * 3) > xMovement) {
e.preventDefault();
}
});

您可以查看我所说的内容,请查看我的页面:http://cipa.ch/forStack/

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="viewport" content="width=640">
</head>
<body style="margin:0;padding:0;">
<iframe frameborder="0" height="100%" width="100%" style="margin:0;padding:0;width:100%;height:90%;position:absolute" src="http://cipa.ch/forStack/test.html" >
</iframe>
</body>
</html>

最佳答案

尝试在 body 标签上添加 position:fixed

body {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
}

关于html - Safari - IPAD - 在没有 -webkit-overflow-scrolling 的情况下禁用弹跳(无滚动),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36474001/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com