Last active
May 4, 2021 15:30
-
-
Save rwaddin/d5adff0129e8dc9239a5ed48915f1490 to your computer and use it in GitHub Desktop.
set active adminlte
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
/** add active class and stay opened when selected */ | |
let url = window.location; | |
// for sidebar menu entirely but not cover treeview | |
$('ul.sidebar-menu a').filter(function() { | |
return this.href === url.href; | |
}).parent().addClass('active'); | |
// for treeview | |
$('ul.treeview-menu a').filter(function() { | |
return this.href === url; | |
}).parentsUntil(".sidebar-menu > .treeview-menu").addClass('active'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment