如何更改 Firefox 中滚动条的颜色(特定)?
我需要更改 Firefox 中的滚动条颜色。使用 CSS 我可以更改 IE 中的滚动条颜色。效果很好。但我在 Firefox 中看不到变化。
我不需要任何自定义滚动条。我只想将颜色应用于默认滚动条。
I need to change the scroll bar color in Firefox. Using CSS I am able to change scroll bar color in IE. It works fine. But I cannot see the change in Firefox.
I dont want any custom scroll bars. I want to apply the color to the default scroll bar only.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
并非所有浏览器都允许您控制滚动条的样式。
您可以使用这样的插件来伪造滚动条,该插件声称是跨浏览器兼容的:
http://www.kelvinluck.com/projects/jscrollpane-custom-cross-browser-scrollbars/
Not all browsers will let you control the styling for their scrollbars.
You can fake scroll bars with plugins like this, which claims to be cross-browser compatible:
http://www.kelvinluck.com/projects/jscrollpane-custom-cross-browser-scrollbars/
您不能对默认滚动条执行此操作。
使用 JavaScript 和 CSS 自定义滚动条,并且可以使用许多插件。
You can't do this for the default scroll bar.
Use a custom scroll bar using javascript and CSS and lots of plugins will be available.
不幸的是,如果没有自定义滚动条,这是不可能实现的。
Unfortunately, this is not doable without custom scroll bars.
使用 jScrollPane 将解决跨浏览器的滚动颜色问题。
用法很简单,例如:
$("#someDivId").jScrollPane();
我在 FireFox/IE/Chrome 下进行了测试,得到了相同的 UI 结果。
也使用了jScrollBar,但是在使用jScrollBar之前需要多个div,而不是一个div。
Using jScrollPane will solve the scroll color cross browsers.
The usage is simple like:
$("#someDivId").jScrollPane();
I tested under FireFox/IE/Chrome and got same UI result.
Also used jScrollBar, but it require several divs before use jScrollBar, instead of one div.
没有 jQuery 就不行。这是因为 bug #77790。
唯一的方法是使用 jQuery 插件。我有链接给你!
• http://plugins.jquery.com/custom-scrollbar/ - jQuery 自定义滚动条< br>
• http://jscrollpane.kelvinluck.com/ - jScrollPane
• https://www.google.ca/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=jquery%20scrollbar - Google 搜索
You simply can't without jQuery. Its because of bug #77790.
The only way is to use a jQuery plugin. I have links for you!
• http://plugins.jquery.com/custom-scrollbar/ - jQuery Custom Scrollbar
• http://jscrollpane.kelvinluck.com/ - jScrollPane
• https://www.google.ca/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=jquery%20scrollbar - Google search
对于 Firefox 或跨浏览器,您可以使用:
jQuery 自定义内容滚动器
更简单易用
Github : https://github.com/malihu/malihu-custom-scrollbar-plugin
如何使用:
从网络或 Github 下载源代码。
在标题中包含 jquery.mCustomScrollbar.concat.min.js 和 jquery.mCustomScrollbar.css。
Add the class mCustomScrollbar to any element you want to add custom scrollbar(s) with default options. Example of mine :
<div class="long40 right reviews-frame mCustomScrollbar">
Call mCustomScrollbar function on the element selector you want to add the scrollbar(s). I call in bottom of my phtml page (list.phtml) like this :
您在其网站上阅读的其他设置和文档。
我在 Magento 中使用的示例:i.imgur.com/3OwGQld.png
以下是我修改的滚动条颜色 css 代码示例:
for Firefox or cross browser you can use :
jQuery custom content scroller
more simple and easy to use
Github : https://github.com/malihu/malihu-custom-scrollbar-plugin
How to use :
Download the source from the web or Github.
Include jquery.mCustomScrollbar.concat.min.js and jquery.mCustomScrollbar.css on your header.
Add the class mCustomScrollbar to any element you want to add custom scrollbar(s) with default options. Example of mine :
<div class="long40 right reviews-frame mCustomScrollbar">
Call mCustomScrollbar function on the element selector you want to add the scrollbar(s). I call in bottom of my phtml page (list.phtml) like this :
Other setting and documentation you read on their web.
Sample I used it in Magento : i.imgur.com/3OwGQld.png
The following example of a scrollbar color css code that I modified :