iOS中的垂直滚动不顺畅

时间:2021-12-16 19:01:00

I've been searching far and wide through documentation regarding -webkit-overflow-scrolling: touch;, but I can only get it to work partially for my <body> element this way...

我一直在通过关于-webkit-overflow-scrolling:touch;的文档进行广泛搜索,但是我只能通过这种方式将它部分地用于我的元素......

<body style="-webkit-overflow-scrolling: touch;">

or like this...

或者像这样......

<body style="overflow-y: auto; -webkit-overflow-scrolling: touch;">

In iOS, my page will scroll with momentum about a fourth of the way down in the page, but then stop. So -webkit-overflow-scrolling: touch does work for a "part" of the body

在iOS中,我的页面将以大约四分之一的速度滚动页面,但随后停止。所以-webkit-overflow-scrolling:touch确实适用于身体的“部分”

Without this code, it will scroll all of the way through the page, but with no momentum and with a lot of jerky motion.

没有这个代码,它将在页面中滚动,但没有动量和很多不稳定的动作。

2 个解决方案

#1


47  

What about applying the -webkit-overflow-scrolling: touch; to all elements of your site:

如何应用-webkit-overflow-scrolling:touch;到您网站的所有元素:

* {
    -webkit-overflow-scrolling: touch;
}

And you should create an extra CSS file instead of using the css attribute.

您应该创建一个额外的CSS文件,而不是使用css属性。

#2


1  

overflow should be 'scroll'

溢出应该是'滚动'

ref: https://css-tricks.com/snippets/css/momentum-scrolling-on-ios-overflow-elements/

#1


47  

What about applying the -webkit-overflow-scrolling: touch; to all elements of your site:

如何应用-webkit-overflow-scrolling:touch;到您网站的所有元素:

* {
    -webkit-overflow-scrolling: touch;
}

And you should create an extra CSS file instead of using the css attribute.

您应该创建一个额外的CSS文件,而不是使用css属性。

#2


1  

overflow should be 'scroll'

溢出应该是'滚动'

ref: https://css-tricks.com/snippets/css/momentum-scrolling-on-ios-overflow-elements/