I have a set of buttons that, when moused over, change color. The CSS for these runs this way:
#navsite ul li button
{
height: 60px;
width: 60px;
background-image: -moz-linear-gradient(bottom, black, #4D4D4D);
box-shadow: 2px 3px 3px 2px #888888;
border-radius: 15px;
border-color: 359ABC;
cursor: pointer;
margin-left: 5px;
margin-right: 5px;
vertical-align: bottom;
}
#navsite ul li button:hover
{
height: 60px;
width: 60px;
background-image: none;
background-color: #00054C;
box-shadow: 2px 3px 3px 2px #888888;
border-radius: 15px;
border-color: 359ABC;
cursor: pointer;
margin-left: 5px;
margin-right: 5px;
vertical-align: bottom;
}
Then, JavaScript changes the color on click (the example below covers one of five buttons, and there is a function for each button, forgive the bulk):
function dude()
{
document.getElementById("dude").hidden=false;
document.getElementById("bob").hidden=true;
document.getElementById("ted").hidden=true;
document.getElementById("joe").hidden=true;
document.getElementById("fred").hidden=true;
document.getElementById("button1").style.background='#00054C';
document.getElementById("button2").style.background='-moz-linear-gradient(bottom, black, #4D4D4D)';
document.getElementById("button3").style.background='-moz-linear-gradient(bottom, black, #4D4D4D)';
document.getElementById("button4").style.background='-moz-linear-gradient(bottom, black, #4D4D4D)';
document.getElementById("button5").style.background='-moz-linear-gradient(bottom, black, #4D4D4D)';
}
My problem now is that after this script has been activated, the CSS rule #navsite ul li button:hover no longer applies, and there is no mouseover effect at all. How do I fix the script so that it doesn't stop the CSS from running properly?
EDIT: Should I be considering converting that CSS clause to a part of the script itself? I've found it impossible to convert the script to CSS clauses, and I'd like to have minimal resources going on.
I've changed the script so that it lists active and inactive classes instead of listing the colors themselves. Its still rather bulky, though; any ideas on how to condense it?