PDA

View Full Version : class="active" on <li>


GriZzm0
06-21-2006, 09:59 PM
This is not really a "How do I?" thread. Its more like a "Is it possible?" thread. :p
Anyhow.

I got a site with "tabs" at the top. Like the tabs on vbulletin.org. (home, forum, mods ad chat). The thing is that I want class="active" on the forum <li> when I'm viewing the forum. and class=active on the home <li> when I view home. etc etc.
Is this possible with vB? Or do I need to code something myself? Or maybe there already is a code for it which I've missed?

tgreer
06-21-2006, 10:07 PM
Some JavaScript would work. Are you a JS coder? The idea is to add "onclick=" to each of your tabs. Set it to a JavaScript function:

onclick=myFunction(this.id);

Your function now knows the id of the tab you clicked. The function would switch the "style" or "class" of that tag to "active", and to all the others to "inactive".

Voila!

GriZzm0
06-21-2006, 10:10 PM
Some JavaScript would work. Are you a JS coder? The idea is to add "onclick=" to each of your tabs. Set it to a JavaScript function:

onclick=myFunction(this.id);

Your function now knows the id of the tab you clicked. The function would switch the "style" or "class" of that tag to "active", and to all the others to "inactive".

Voila!
Well, the tabs are reloaded with the whole page each time you press on a link. So that wouldn't really work.
And no, I'm not a javascript coder.