gpt4 book ai didi

html - iOS Safari : scrolling is broken inside position: fixed; elements

转载 作者:行者123 更新时间:2023-12-04 13:11:50 24 4
gpt4 key购买 nike

内部 position: fixed;元素,如果您尝试在触摸开始时以错误的方式滚动元素,滚动元素将“锁定”。
示例:触摸屏幕并向下拖动,然后再向上拖动。该元素不会滚动。如果松开,请等待几秒钟,然后尝试向上拖动,它将滚动。
http://12me21.github.io/scroll-test.html

body {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
#scroll-container {
overflow-y: scroll;
height: 100%;
}
#scroller {
height: 200vh;
font-size: 50px;
}
<body>
<div id=scroll-container>
<div id=scroller>Test<br>more text</div>
</div>
</body>

本回答: https://stackoverflow.com/a/51733026/6232794似乎与我遇到的问题相同,但修复不再有效。它似乎发生在所有固定元素内部,而不是由 -webkit-overflow-scrolling: touch; 引起的了。
现在有什么办法可以解决这个问题吗?还是我只需要避免 position: fixed;完全?

最佳答案

添加 overflow: hidden;<html><body>似乎修复它。
我不确定为什么会这样,但我认为问题是 safari 试图滚动 html/body 而不是你想要的元素。
因为可滚动部分在 position:fixed 内元素,滚动 body 没有视觉效果,所以看起来什么都没有发生。

关于html - iOS Safari : scrolling is broken inside position: fixed; elements,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64344560/

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