highlight current page on side nav

This commit is contained in:
root
2019-04-09 17:45:28 -04:00
parent cb2eefe8d4
commit 13723fb3c5
2 changed files with 3 additions and 11 deletions

View File

@@ -40,17 +40,9 @@ $('#dT').dataTable( {
}); });
//Highlight top nav menu item with current page // Highlight the active nav link on side nav
$(function() { $(function() {
// Highlight the active nav link.
var url = window.location.pathname; var url = window.location.pathname;
var filename = url.substr(url.lastIndexOf('/') + 1); var filename = url.substr(url.lastIndexOf('/') + 1);
$('.navbar a[href$="' + filename + '"]').parent().addClass("active"); $('.navbar-nav a[href$="' + filename + '"]').parent().addClass("active");
});
$(function() {
// Highlight the active nav link.
var url = window.location.pathname;
var filename = url.substr(url.lastIndexOf('/') + 1);
$('.nav a[href$="' + filename + '"]').parent().addClass("active");
}); });

View File

@@ -1,6 +1,6 @@
<!-- Sidebar --> <!-- Sidebar -->
<ul class="sidebar navbar-nav d-print-none"> <ul class="sidebar navbar-nav d-print-none">
<li class="nav-item active"> <li class="nav-item">
<a class="nav-link" href="dashboard.php"> <a class="nav-link" href="dashboard.php">
<i class="fas fa-fw fa-tachometer-alt mx-2"></i> <i class="fas fa-fw fa-tachometer-alt mx-2"></i>
<span>Dashboard</span> <span>Dashboard</span>