jQuery LavaLamp menu selection

340 Views Asked by At

I'm sure many of you are aware of the jQuery LavaLamp: http://www.gmarwaha.com/blog/2007/08/23/lavalamp-for-jquery-lovers/

I know that I can make the class="current" of my li tag if I want to manually select what option is selected, but is their a way I can choose what menu item is selected depending on what parameter is shown in the address bar (i.e. index.html#page-1, #page-2, #page-3...).

Thanks to anyone who can help me out!

1

There are 1 best solutions below

0
Tarek Fadel On

You can use the window.location.hash as the selector so something like this:

if ("" != window.location.hash) {
    $(window.location.hash).addClass("current");
}

That should give you the desired result.