Javascript 溢出-y:在 Chrome 中滚动不显示滚动条

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35201566/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 17:23:25  来源:igfitidea点击:

Overflow-y: Scroll not showing scrollbar in Chrome

javascriptjqueryhtmlcssgoogle-chrome

提问by Graham Cairns

I am generating a list of organisations of the left hand side of this page: http://www.ihhub.org/member-map/

我正在生成此页面左侧的组织列表:http: //www.ihhub.org/member-map/

This list is generated through appending <span>tags that are linked to the corresponding map.

该列表是通过附加<span>链接到相应地图的标签生成的。

My issue is - the scroll bar does not appear in CHROME but does appear in Firefox and Safari.

我的问题是 - 滚动条没有出现在 CHROME 中,但出现在 Firefox 和 Safari 中。

Any solutions?

任何解决方案?

UPDATE:

更新:

This issue appears to be isolated to MAC OS.

此问题似乎与 MAC OS 无关。

SOLUTION:

解决方案:

::-webkit-scrollbar {
    -webkit-appearance: none;
    width: 7px;
}
::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background-color: rgba(0,0,0,.5);
    -webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
}

回答by Graham Cairns

According to CSS - Overflow: Scroll; - Always show vertical scroll bar?: OSx Lion hides scrollbars while not in use to make it seem more "slick", but at the same time the issue you addressed comes up: people sometimes cannot see whether a div has a scroll feature or not.

根据CSS - 溢出:滚动;- 总是显示垂直滚动条?:OSx Lion 在不使用时隐藏滚动条以使其看起来更“光滑”,但同时您解决的问题出现了:人们有时无法看到 div 是否具有滚动功能。

CSS fix:

CSS修复:

::-webkit-scrollbar {
    -webkit-appearance: none;
    width: 7px;
}
::-webkit-scrollbar-thumb {
    border-radius: 4px;
    background-color: rgba(0,0,0,.5);
    -webkit-box-shadow: 0 0 1px rgba(255,255,255,.5);
}

回答by Timo

I am seeing scroll bar well. If you are using Mac, you may want to make sure that scrollbars are always shown

我很好地看到了滚动条。如果您使用的是 Mac,您可能需要确保始终显示滚动条

System preferences >>general

系统偏好 >>一般

回答by Timo

Add this to your css

将此添加到您的 css

.list::-webkit-scrollbar {
    -webkit-appearance: scrollbartrack-vertical;
}    

or

或者

.list::-webkit-scrollbar {
   -webkit-appearance: scrollbarthumb-vertical;
} 

回答by Ajay Gupta

I am using Windows 8 and Google Chrome version is 48.0.2564.97. And its working perfect. See in image highlighted area.

我使用的是 Windows 8,谷歌浏览器版本是 48.0.2564.97。它的工作完美。请参见图像突出显示区域。

enter image description here

在此处输入图片说明

回答by naman

I am using Crome Version 48.0.2564.97 m

我使用的是 Crome 版本 48.0.2564.97 m

And it is working just fine.. Change it to overflow-y:auto in case if there are not enough items it will not show scroll.

它工作得很好.. 将其更改为 overflow-y:auto 以防万一没有足够的项目它不会显示滚动。

enter image description here

在此处输入图片说明