Reputation: 3283
I want to change the color of the scroll bar.For creating the scroll bar I used the given code.
javascript is
$('.scroll-pane').jScrollPane();
$('#body').bind(
'jsp-scroll-y',
function (event, scrollPositionY, isAtTop, isAtBottom) {
console.log('#pane1 Handle jsp-scroll-y', this,
'scrollPositionY=', scrollPositionY,
'isAtTop=', isAtTop,
'isAtBottom=', isAtBottom);
}
);
css is
.scroll-pane
{
width: 100%;
height: 300px;
overflow: auto;
}
But here I cannot change the color of the scroll bar.How can I change the color? Demo
Upvotes: 1
Views: 2331
Reputation: 246
We can change color of scrollbar using javascript also. There are various components in scroll bar like base color, face color, arrow color etc that changes color of various parts of scroll bar. The following lines might help you.
document.body.style.scrollbarBaseColor = "colorname";
document.body.style.scrollbarArrowColor = "colorname";
document.body.style.scrollbarTrackColor = "colorname";
Apart from the above styles, you will have scrollbarShadowColor, scrollbarHighlightColor, scrollbar3dlightColor,scrollbarDarkshadowColor etc. So, choose your component of scroll bar and change the color of it.
Upvotes: 0
Reputation: 6873
You can stylize drag element .jspDrag
:
.jspDrag {
background-color: #000;
}
and the scollbar .jspVerticalBar
itself:
.jspVerticalBar {
background-color: rgba(0,0,0,0.5);
}
UPD Working example http://jsfiddle.net/KVyAG/2/
Upvotes: 2
Reputation: 7250
These two elements are basically the scroll bar and drag handler.
.jspTrack {
background: lightgray !important;
}
.jspDrag {
background: gray !important;
}
Edit: really making sure the colors get applied.
Upvotes: 4
Reputation: 4239
This may help you. For particular class or id you can just write name of class or id instead of BODY
<style type="text/css">
BODY{
scrollbar-face-color:#DFFFBF;
scrollbar-shadow-color:green;
}
</style>
You can also use following property:
Upvotes: 1
Reputation: 606
Try this:
.scroll-pane
{
width: 100%;
height: 300px;
overflow: auto;
background-color:#000000;
}
Upvotes: 0