I am a new ASP.NET Web Forms developer and trying to use Twitter Bootstrap with the Master Page. I am struggling with setting navbar item as active when user selects it. I creat
var windowUrl = window.location.href.toLowerCase();
//var windowUrl = window.location.href.toLowerCase().split('.')[0];
setTimeout(function () {
var windowUrl = window.location.href.toLowerCase();
$('#nav li').removeClass('active');
$('#nav li').each(function (index) {
pageUrl = $(this).find('a').attr('href');
if (windowUrl.indexOf(pageUrl) > -1) {
$(this).addClass('active');
}
});
}, 10);