What I have is a basic navigation with five links. The navigation bar has a background image and a darker shade when there's a mouse hover. What I'm trying to do is add a little jquery script to the top of each page to change the color of the link of the current page to the hover color... ie. if I'm on the contact page the contact link on the nav bar would be the darker color so that it's very obvious which page you're on. So far I have this:
<div class="navigation">
<ul>
<li><a href="index.html" id="home">Home</a></li>
<li><a href="reviews.html" id="reviews">Reviews</a></li>
<li><a href="guestbook.html" id="guestbook">Guestbook</a></li>
<li><a href="book.html" target="_blank" id="about">About</a></li>
<li><a href="contact.html" id="contact">Contact</a></li></ul>
</div>
and then something like this at the top of each of the pages (here would be the one for reviews.html)
<head>
<script src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#reviews').css("background-color", "#6d7f45");
});
</script>
</head>
But it's not working at all. I've just started using JQuery so I'm sure it's something simple, but I've tried a number of solutions on my own and I'm stumped.
CSS:
div.navigation {
width: 950px;
background-image: url('../images/navbg.png');
letter-spacing:2px;
height: 35px;
background-color: #679847;
text-transform:uppercase;
}
div.navigation ul {
padding-right: 50px;
padding-left: 50px;
padding-top: 10px;
list-style:none;
}
div.navigation li {
display: inline;
margin-left: 10px;
margin-right: 10px;
}
div.navigation a {
background-image: url('../images/navbg.png');
text-decoration: none;
padding: 8px;
color: #FFFFFF;
}
div.navigation a:link {
color:#FFFFFF;
text-decoration:none;
} /* unvisited link */
div.navigation a:visited {
color:#FFFFFF;
text-decoration:none;
} /* visited link */
div.navigation a:hover {
background-image: url('../images/navbg_hover.png');
color:#FFFFFF;
text-decoration:none;
background-color: #6d7f45;
} /* mouse over link */
div.navigation a:active {
color:#FFFFFF;
text-decoration:none;
} /* selected link */