如何更改 Firefox 中滚动条的颜色(特定)?

发布于 2024-09-06 18:38:03 字数 114 浏览 10 评论 0原文

我需要更改 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

我喜欢麦丽素 2024-09-13 18:38:03

并非所有浏览器都允许您控制滚动条的样式。

您可以使用这样的插件来伪造滚动条,该插件声称是跨浏览器兼容的:

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/

戈亓 2024-09-13 18:38:03

您不能对默认滚动条执行此操作。

使用 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.

爱的十字路口 2024-09-13 18:38:03

不幸的是,如果没有自定义滚动条,这是不可能实现的。

Unfortunately, this is not doable without custom scroll bars.

眉目亦如画i 2024-09-13 18:38:03

使用 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.

情深如许 2024-09-13 18:38:03

没有 jQuery 就不行。这是因为 bug #77790。

错误 77790 - (scrollbar-colors) 设置滚动条样式(将 ::-moz-horizo​​ntal-scrollbar 绑定到 XBL)

唯一的方法是使用 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.

Bug 77790 - (scrollbar-colors) Style the scrollbar (binding ::-moz-horizontal-scrollbar to XBL)

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

眉黛浅 2024-09-13 18:38:03

对于 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 :

....    
</div>
<script>
(function($){
    $(window).load(function(){
        $(".content").mCustomScrollbar();
    });
})(jQuery);
</script>

您在其网站上阅读的其他设置和文档。

我在 Magento 中使用的示例:i.imgur.com/3OwGQld.png

以下是我修改的滚动条颜色 css 代码示例:

#mCSB_1_dragger_vertical {
   height: 130px !important; /* height of the scrollbar */
}
.mCSB_dragger_bar {
   background-color: #ececec !important; /* color of the dragger bar */
}
.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar {
   width: 10px !important; /* width of the dragger bar */
}
.mCSB_scrollTools .mCSB_draggerRail {
   background-color: #888888 !important; /* color of the rail */
   width: 10px !important; /* width of the rail for dragger bar */
}

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 :

....    
</div>
<script>
(function($){
    $(window).load(function(){
        $(".content").mCustomScrollbar();
    });
})(jQuery);
</script>

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 :

#mCSB_1_dragger_vertical {
   height: 130px !important; /* height of the scrollbar */
}
.mCSB_dragger_bar {
   background-color: #ececec !important; /* color of the dragger bar */
}
.mCSB_scrollTools .mCSB_dragger .mCSB_dragger_bar {
   width: 10px !important; /* width of the dragger bar */
}
.mCSB_scrollTools .mCSB_draggerRail {
   background-color: #888888 !important; /* color of the rail */
   width: 10px !important; /* width of the rail for dragger bar */
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文