JS: indicating the current item in the menu
I have a menu:
<ul>
<li id="active"><a href="/"></a></li>
<li><a href="/about/"> і</a></li>
<li><a href="/work/">іі</a></li>
<li><a href="/initiative/">Ііі</a></li>
<li><a href="/statti/">і</a></li>
</ul>
Can you suggest a way to change id = the active attribute for this list. If, for example, I clicked, I want this element li to be marked as active.
thanks
+3
4 answers
There is an elegant css method to create an active navigation state without javascript or server support. In principle, a single id (for example, as an attribute of the body id) that uniquely identifies the navigation state is enough to create css selectors that highlight the active state.
+2
, , . ( . http://css-discuss.incutio.com/?page=ClassesVsIds. .)
, jQuery, : http://docs.jquery.com/Attributes
""
0