简体   繁体   English

使滚动条在 iOS 15 上始终可见不起作用

[英]Make scrollbar always visible on iOS 15 doesn't work

I'm trying to make the scrollbar of a div (not the entire body) always visible, it works everywhere except on Safari & Chrome on iOS.我正在尝试使 div 的滚动条(不是整个主体)始终可见,它可以在除 iOS 上的 Safari 和 Chrome 之外的任何地方使用。 It looks like ::-webkit-scrollbar doesn't work on iOS.看起来 ::-webkit-scrollbar 在 iOS 上不起作用。

The CSS that I've tried, that works everywhere but on iOS:我尝试过的 CSS 可以在任何地方使用,但在 iOS 上除外:

::-webkit-scrollbar {
   width: 20px;
   background: red;
}

Do you know any workaround to make it work?您知道使其工作的任何解决方法吗? Do you know why iOS doesn't support that?你知道为什么iOS不支持吗?

Thanks!谢谢!

Try:尝试:

html,
html > * {
    -moz-overflow: -moz-scrollbars-vertical;
         overflow-y: scroll;
}
body::-webkit-scrollbar {
    width: 20px;
    background: red;
}

Hope this works.希望这有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM