<ul> <li class="current"><a href="#" >Home</a></li> <li><a href="#" >Services</a></li> <li><a href="#" >About</a></li> </ul> a { background-color: blue; } a:hover { background-color: green; } .selected { background-color: red; color: fff; }
How to implement the selection of the navigation menu item when this page is opened from the menu? Those. The HOME page is open and the menu item connects the class SELECTED. And how is this selection called?
hashchange
, you will have 3 options: - write a capture of this event yourself - use one of the many jQuery plugins - use a specialized routing library - Specter