Solved

Change browser scrollbar color

Posted on 2003-11-20
10
2,264 Views
Last Modified: 2010-04-09
Hello,

How can the browser's scrollbar color change, like on this link:

http://www.woodyswatch.com/access/

0
Comment
Question by:ornicar
  • 3
  • 2
  • 2
  • +2
10 Comments
 
LVL 8

Assisted Solution

by:MusicMan
MusicMan earned 100 total points
ID: 9788385
Try here

http://www.codelifter.com/main/javascript/changescrollbarcolor1.html

They have a neat script to do just what you want.

HTH
MM
0
 
LVL 15

Expert Comment

by:Daydreams
ID: 9788756
You can do it easily with CSS:
(From http://www.websitetips.com/info/css/scrollbars.html)

<html>
<head>

<style type="text/css">
<!--

body {scrollbar-3dlight-color:gold;
scrollbar-arrow-color:yellow;
scrollbar-base-color:tomato;
scrollbar-darkshadow-color:orange;
scrollbar-face-color:teal;
scrollbar-highlight-color:hotpink;
scrollbar-shadow-color:magenta}


-->
</style>

</head>
<body>
<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>. The <p>'s are here just to fill the page so you can see the whole scrollbar since there is no other content to scroll.
</body>
</html>

0
 
LVL 15

Accepted Solution

by:
Daydreams earned 200 total points
ID: 9788821
Or try this fun script, (and hover your mouse over the scrollbar to see the color change):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>scrollbar colors onmouse</title>
</head>
<body onmousemove="move()" link="#00FFFF" vlink="#00FFFF">

<script language="javascript"><!--
function move()
 {
  chk = document.body.clientWidth + 2;
  if(window.event.x > chk) //Ist Mauszeiger über Scrollbar?
   {
    var sfc = "powderblue";     //scrollbar-face-color
    var ssc = "red";     //scrollbar-shadow-color
    var shc = "blue"; //scrollbar-highlight-color
    var stc = "yellow"; //scrollbar-track-color
    var sac = "green"; //scrollbar-arrow-color

    document.body.style.scrollbarFaceColor = sfc;
    document.body.style.scrollbarShadowColor = ssc;
    document.body.style.scrollbarTrackColor = stc;
    document.body.style.scrollbarHighlightColor = shc;
    document.body.style.scrollbarArrowColor = sac;
   }
  else //wenn Mauszeiger nicht über Scrollbar
   {
    var sfc = "orange"; //scrollbar-face-color
    var ssc = "red"; //scrollbar-shadow-color
    var shc = "white"; //scrollbar-highlight-color
    var stc = "lightblue"; //scrollbar-track-color
    var sac = "blue";       //scrollbar-arrow-color

    document.body.style.scrollbarFaceColor = sfc;
    document.body.style.scrollbarShadowColor = ssc;
    document.body.style.scrollbarTrackColor = stc;
    document.body.style.scrollbarHighlightColor = shc;
    document.body.style.scrollbarArrowColor = sac;
   }
 } // -->
</script>
<h1>Hover your mouse over the scrollbar<br>
 and see it change colors</h1>
<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p> <p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.<p>.
</body>

</html>
0
 
LVL 11

Expert Comment

by:Zontar
ID: 9789919
Note that this is MSIE/Windows only, and will not work with other browsers (and the JS solutions offered may cause errors in them as well).
0
 
LVL 9

Author Comment

by:ornicar
ID: 9790067
The CSS work only with IE?
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 35

Assisted Solution

by:YZlat
YZlat earned 100 total points
ID: 9796620
<style>
body {
 scrollbar-track-color:#FFC7DB;

 scrollbar-face-color:#00E9FF;
 scrollbar-highlight-color:#B5224E;

 scrollbar-3dlight-color:#FF00FF;
 scrollbar-base-color:blue;
 scrollbar-darkshadow-color:black;
 scrollbar-shadow-color:#FFD1F0;
 scrollbar-arrow-color:#DA8DFF;
}

</style>
0
 
LVL 11

Assisted Solution

by:Zontar
Zontar earned 100 total points
ID: 9797017
>  The CSS work only with IE?

Some of it will also work with recent versions of Opera for Windows *if* the user has allowed it in his preferences. The preference is disabled by default. The styles won't work at all in Mozilla, Safari, Konqeror, any version of Netscape, or IE/Mac. Personally I prefer using a browser that doesn't support this -- the purpose of CSS is to allow web authors to set the presentation of their pages, not to let them monkey around with my user interface. It would appear that W3C agrees with this sentiment, which is why none of the scrollbar-related styles are part of the CSS-2 specification. Nor will you find them in the CSS-2.1 or CSS-3 drafts.
0
 
LVL 9

Author Comment

by:ornicar
ID: 9828027
Thanks a lot.
0
 
LVL 15

Expert Comment

by:Daydreams
ID: 9828257
ornicar, you're welcome.. and thanks for the A:)
0
 
LVL 8

Expert Comment

by:MusicMan
ID: 9828660
Glad to have been of assistance :)
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now