gpt4 book ai didi

javascript - 当固定元素获得焦点时,ios8 中的 Safari 会滚动屏幕

转载 作者:IT王子 更新时间:2023-10-29 02:44:49 33 4
gpt4 key购买 nike

在IOS8 Safari中有一个位置固定的新bug。

如果您将焦点放在固定面板中的文本区域,Safari 会将您滚动到页面底部。

这使得各种 UI 无法使用,因为您无法在不将页面一直向下滚动并丢失位置的情况下将文本输入文本区域。

有没有办法彻底解决这个错误?

#a {
height: 10000px;
background: linear-gradient(red, blue);
}
#b {
position: fixed;
bottom: 20px;
left: 10%;
width: 100%;
height: 300px;
}

textarea {
width: 80%;
height: 300px;
}
<html>
<body>
<div id="a"></div>
<div id="b"><textarea></textarea></div>
</body>
</html>

最佳答案

基于此good analysis关于这个问题,我在 css 中的 htmlbody 元素中使用了它:

html,body{
-webkit-overflow-scrolling : touch !important;
overflow: auto !important;
height: 100% !important;
}

我认为它对我来说效果很好。

关于javascript - 当固定元素获得焦点时,ios8 中的 Safari 会滚动屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29001977/

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