How To Create Menu Active link Using java script in website
<script>
function onCancel() {
window.location.href = "/Home/Index";
}
$(function () {
setNavigation();
});
function setNavigation() {
var path = window.location.pathname;
path = path.replace(/\/$/, "");
path = decodeURIComponent(path);
$(".sidebar-menu a").each(function () {
var href = $(this).attr('href');
if (path.substring(0, href.length) === href) {
$(this).parents('li').parents('li').addClass('active');
var path1 = path.split('/');
var heref1 = href.split('/');
if (path1[2] === heref1[2]) {
$(this).parents('li').addClass('active');
}
}
});
}
</script>
Wow, What a Excellent post. I really found this to much informatics. It is what i was searching for.I would like to suggest you that please keep sharing such type of info.Thanks hospedaje web compartido
ReplyDelete