22

有没有办法控制 div 标签的滚动条的样式?我在 IE7 和 FireFox 3.5.2 之间遇到了一些对比问题。任何帮助将不胜感激!

4

5 回答 5

28

使用 javascript 您可以设置滚动条的样式。在 IE 和 FF 中都可以正常工作。

检查以下链接

从 Twinhelix , Example 2 , Example 3 [or] 你可以通过点击下面的链接找到大约 30 种滚动样式类型 30 滚动技术

于 2009-08-11T10:33:04.673 回答
2

不,您不能在 Firefox、Safari 等中。您可以在 Internet Explorer 中。有几个脚本可以让您制作滚动条。

于 2009-08-10T18:00:45.980 回答
2

这个做得很好它的滚动工作。它很容易理解,只有几行代码,写得很好,完全可读。

于 2010-10-06T19:04:28.250 回答
2

看着网络,我发现了一些简单的方法来设置滚动条的样式。

这就是那个家伙! http://almaer.com/blog/creating-custom-scrollbars-with-css-how-css-isnt-great-for-every-task

这是我的实现! https://dl.dropbox.com/u/1471066/cloudBI/cssScrollbars.png

/* Turn on a 13x13 scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 13px;
}

::-webkit-scrollbar-button:vertical {
    background-color: silver;
    border: 1px solid gray;
}

/* Turn on single button up on top, and down on bottom */
::-webkit-scrollbar-button:start:decrement,
::-webkit-scrollbar-button:end:increment {
    display: block;
}

/* Turn off the down area up on top, and up area on bottom */
::-webkit-scrollbar-button:vertical:start:increment,
::-webkit-scrollbar-button:vertical:end:decrement {
    display: none;
}

/* Place The scroll down button at the bottom */
::-webkit-scrollbar-button:vertical:increment {
    display: none;
}

/* Place The scroll up button at the up */
::-webkit-scrollbar-button:vertical:decrement {
    display: none;
}

/* Place The scroll down button at the bottom */
::-webkit-scrollbar-button:horizontal:increment {
    display: none;
}

/* Place The scroll up button at the up */
::-webkit-scrollbar-button:horizontal:decrement {
    display: none;
}

::-webkit-scrollbar-track:vertical {
    background-color: blue;
    border: 1px dashed pink;
}

/* Top area above thumb and below up button */
::-webkit-scrollbar-track-piece:vertical:start {
    border: 0px;
}

/* Bottom area below thumb and down button */
::-webkit-scrollbar-track-piece:vertical:end {
    border: 0px;
}

/* Track below and above */
::-webkit-scrollbar-track-piece {
    background-color: silver;
}

/* The thumb itself */
::-webkit-scrollbar-thumb:vertical {
    height: 50px;
    background-color: gray;
}

/* The thumb itself */
::-webkit-scrollbar-thumb:horizontal {
    height: 50px;
    background-color: gray;
}

/* Corner */
::-webkit-scrollbar-corner:vertical {
    background-color: black;
}

/* Resizer */
::-webkit-scrollbar-resizer:vertical {
    background-color: gray;
}
于 2012-10-02T21:30:27.667 回答
0

还有一个 iScroll 项目,它允许您设置滚动条的样式并使其与触摸设备一起使用。 http://cubiq.org/iscroll-4

于 2012-04-04T18:53:50.970 回答