i am using the below script for main menu highlight ( menu1 )
HTML
- menu1
- menu2
SCRIPT
var link = document.location.href.split('/').slice(-1); // retrieve page name
$('nav#test1 li a.active').removeClass('active'); // remove class 'active'
$('nav#test1 li a[href$="'+link+'"]').addClass('active');
ex: http://www.example.com/content/menu1
menu1 menu2 menu3…
But, if the the URL is of
http://www.example.com/content/menu1/story.html
how do i highlight menu1 if the title/page appends the menu1 by jquery or javascript.
Thanks in advance
Should solve your problem