It seems that that particular implementation is leaving is up to you to adjust which one is active on each page of yours.
The sprite2 plugin seems to use the active class to achieve two jobs. To affect the presentation of the nav item, and to prevent the attachment of an event on to that active nav item.
That can be a viable solution when clicking the item doesn’t result in a new page being loaded.
For myself, I prefer to use the body element in conjunction with the nav item to target an individual nav item without needing to set a separate active class within the navigation.
In this case, because an identifier is used on the nav items, we could use a class name on the body element.
<body class="services">
...
So that instead of .spritesnav #snservices.active a:link you could instead use the following sort of CSS to achieve the same effect: .services .spritesnav #services a:link
I’m sorry but I don’t understand your answer in its entirety. CSS/JS is so not my thing
So I am using the nav bar to sort php generated tables which means the site never refreshes in its entirety so according to you making the classes active dynamically should be possible right?
Would I put class=“services” into the div tag surrounding the ul? And how would it work? Would the class always change according to whichever one is active? I.E. if I click on About, would the class change to class=“about”?
I guess the core thing which I don’t understand is how the code recognizes which one is supposed to be active, shouldn’t there be some onclick function or something like that?
Indeed - how that happens, is whenever you click on a nav link, you would remove the active class from all of the nav links, and then add the active class to the one that was clicked on.
Lastly, because the code prevents a click event from being attached to the active link, you will need to stop that prevention from occurring, and instead exit out early from the click event if the clicked link is currently active.
That’s because it’s unrelated to your particular usage needs. Ignore it.
So I chose to implement a simpler navi bar just for the start and read up on the other one later.
The bar works perfectly when tested in isolation but on the php site it resets when I order the table.
The way I order the table is by using a variable [PHP$order_var
which changes the php extension at the top.
Since the nav bar is resetting everytime I click an items I assume the page is refreshing in a way?
Is it even possible to make something like that work?
Here is the javascript I am using