I try to use jquery to initialize active class from navigation, but so far it works only if there's nothing else after the menu item in url.
For ex, if i go on users site.com/users
the code works, but when i browse the controller and i give it parameters it disappears ex site.com/users/param1/param2
below you can see my code:
$(document).ready(function () {
var url = window.location;
// Will only work if string in href matches with location
$('ul.nav a[href="' + url + '"]').parent().addClass('active');
// Will also work for relative and absolute hrefs
$('ul.nav a').filter(function () {
return this.href == url;
}).parent().addClass('active').parent().parent().addClass('active');
});