2014-10-01 78 views
0

我有一個自定義垂直滾動條的div框,我設計了一個使用css/jquery的水平滾動條。我需要給設計的滾動條的確切外觀esp的顏色。是否有任何jQuery/JavaScript代碼,我可以用它來獲得自定義滾動條的顏色。獲取滾動條的顏色

+1

http://stackoverflow.com/questions在所有的瀏覽器實現/ 9251354/css-customized-scroll-bar-in-div – 2014-10-01 05:34:29

回答

0

通過CSS,你可以設置只-webkit支持的瀏覽器火狐,因爲支持dosnt CSS滾動條通過使用像nicescroll插件和其他

::-webkit-scrollbar { 
    width: 7px; 
} 

/* Track */ 
::-webkit-scrollbar-track { 
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3); 
    -webkit-border-radius: 10px; 
    border-radius: 10px; 
} 

/* Handle */ 
::-webkit-scrollbar-thumb { 
    -webkit-border-radius: 10px; 
    border-radius: 10px; 
    background:#c0a062; 
    -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.5); 
} 
::-webkit-scrollbar-thumb:window-inactive { 
    background:#c0a062; 
} 
1
:-webkit-scrollbar { 
    width: 1em; 

} 

::-webkit-scrollbar-track { 
    -webkit-box-shadow: inset 0 0 6px #989898); 
} 

::-webkit-scrollbar-thumb { 
background: -moz-linear-gradient(90deg, rgba(153,218,255,0) 0%, rgba(210,106,120,1) 100%); /* ff3.6+ */ 
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, rgba(210,106,120,1)), color-stop(100%, rgba(153,218,255,0))); /* safari4+,chrome */ 
background: -webkit-linear-gradient(90deg, rgba(153,218,255,0) 0%, rgba(210,106,120,1) 100%); /* safari5.1+,chrome10+ */ 
background: -o-linear-gradient(90deg, rgba(153,218,255,0) 0%, rgba(210,106,120,1) 100%); /* opera 11.10+ */ 
background: -ms-linear-gradient(90deg, rgba(153,218,255,0) 0%, rgba(210,106,120,1) 100%); /* ie10+ */ 
background: linear-gradient(0deg, rgba(153,218,255,0) 0%, rgba(210,106,120,1) 100%); /* w3c */ 
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#d26a78', endColorstr='#99DAFF',GradientType=0); /* ie6-9 *///outline: 1px solid #D17626; 
    border-radius:5px; 
} 
+0

我的確在尋找自定義窗口滾動條的顏色,而不是設置顏色 – 2014-10-01 17:05:11