Hello all, and thanks for making this available.
I am trying to add a class to my menu for the page it is currently on.
I followed this example:
http://docs.jquery.com/Tutorials:Auto-Selecting_Navigation
But I am not able to make it work at all.
Here is my HTML:
Product
News & Events
Support
Dealer Locator
About
To make the nav element highlighted, the list item must have a class
of 'hover' like this '...'
And here is my jQuery:
var path = location.pathname.substring(1);
if ( path )
$('#mainNav a...@href$="' + path + '"]').parent().attr('class',
'hover');
For the page /support for example, alert(path) would say 'support'.
The script is not applying any CSS to the list elements. I tried
different combinations, tried to add a class to the a element by
removing parent(), but nothing is triggering.
Please help.
Thanks,
Francois