聚焦输入时iOS上的触摸滚动问题 [英] Issues with touch scroll on iOS when focusing inputs
问题描述
我在iOS上遇到了一些可滚动div的问题。当尝试通过触摸输入外滚动时,它滚动没有任何问题,但是当我尝试滚动并触摸输入以开始滚动时(有很多机会发生它,因为它是一个带有大量输入的div )它滚动整个窗口而不是滚动div。我在桌面或Android中没有这个问题。我发现了类似的问题( iOS HTML输入标记在Scrollable中停止滚动元素)但它也没有任何答案。虽然我找不到任何好的解决方案,但我决定在用户触摸输入时阻止事件 touchmove
,但这并不是我想要的。
I am having some issues with a scrollable div on iOS. When trying to scroll by touching outside an input, it scrolls ok without any problem but when I try to scroll and I touch an input to start scrolling (there are a lot of chances that it happens because it is a div with a lot of inputs) it scrolls the whole window instead scrolling the div. I don't have that problem either in desktop or Android. I found a similar question (iOS HTML Input Tag Stops Scrolling in Scrollable Element) but it doesn't have any answer either. While I don't find any good solution, I decided to prevent the event touchmove
when the user touches an input, but it is not exactly what I want.
也许某人已经遇到过这个问题,可以提供帮助。我非常感谢,提前感谢。
Maybe someone already faced this problem and can help. I would really appreciate it, thanks in advance.
推荐答案
要在iOS 5+上滚动本机动力,您需要:
To get native momentum scrolling on iOS 5+, you'll need:
div {
overflow: scroll;
-webkit-overflow-scrolling: touch;
}
资料来源:溢出
也许你还需要:
div > * {
-webkit-transform: translateZ(0px);
}
来源2:另一个类似的问题
这篇关于聚焦输入时iOS上的触摸滚动问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!