I would like to make a navigation menu with color fading using jQuery, in which the button “pressed” corresponding to the current page behaves differently than the button “not pressed” (in particular, it does not disappear under a different color when it hangs). If I look at the example at www.guitaracademy.nl, I see that they use their own javascript with the window.location.hash property.
However, I cannot get this hash in jQuery. Here is an example script:
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
var p=window.location.hash;
$("#clickme").click(function(){
alert(p)
});
});
</script>
</head>
<body>
<a href="#test">Click me first</a>
<div id="clickme">Then click me</div>
</body>
</html>
After loading this page I will click the link "Click me first"; then in the address bar I see "#test" added to the original URL. However, if I then clicked the "Then click me" div, I see a blank warning. The hash does not seem to be "updated".
.