I am trying to use this menu for my wordpress site.
I am just wondering how can I make the float line change color for each nav item hovered/selected, cos it is red (background-color:#800; height:2px;) for all at the moment.
This is what I am trying to achieve:
Menu 1 – the hovering float line is green,
Menu 2 – the float line is yellow,
Menu 3 – red, menu4 – blue and so on.
Any help is appreciated.
Thank you.
There is a more “CSS” way to achieve this but with some javascript you can get something quite readable. With this approach, your pages will need to correctly initialize the float line (
.hightlight) and the nav border (#sses1 > ul).The ideal solution would be a class for each float lines but here’s what I got with javascript only :
Before the body or window is loaded :
To ensure that the selector is only use once .highlight exists, I suggest to modify the end of the original javascript to this:
Take a look at this jsfiddle.
P.S.: the event chain is slighly modified to fit into jsfiddle.