In the previous version of AdminLTE which is the Bootstrap 3 there is a fix to make the sidebar dynamically active when selected.
Here's the code used
$(function(){
/** add active class and stay opened when selected */
var url = window.location;
// for sidebar menu entirely but not cover treeview
$('ul.sidebar-menu a').filter(function() {
return this.href == url;
}).parent().addClass('active');
// for treeview
$('ul.treeview-menu a').filter(function() {
return this.href == url;
}).parentsUntil(".sidebar-menu > .treeview-menu").addClass('active');
});
but now in AdminLTE 3 this code is not working.
Is anyone already tried this? and produced a resolution?
Thanks in advance
Hello @jvbalcita
Can you test this, please:
/** add active class and stay opened when selected */
var url = window.location;
// for sidebar menu entirely but not cover treeview
$('ul.nav-sidebar a').filter(function() {
return this.href == url;
}).addClass('active');
// for treeview
$('ul.nav-treeview a').filter(function() {
return this.href == url;
}).parentsUntil(".nav-sidebar > .nav-treeview").addClass('menu-open').prev('a').addClass('active');
it's working @arbex10 . Thank you very much!
Hello @jvbalcita
Can you test this, please:
/** add active class and stay opened when selected */
var url = window.location;// for sidebar menu entirely but not cover treeview
$('ul.nav-sidebar a').filter(function() {
return this.href == url;
}).addClass('active');// for treeview
$('ul.nav-treeview a').filter(function() {
return this.href == url;
}).parentsUntil(".nav-sidebar > .nav-treeview").addClass('menu-open') .prev('a').addClass('active');
hey bro, this code where? iam sorry my english not good.
thanks
it's working @arbex10 . Thank you very much!
hey bro, this code ppaste where?sorry my english not good
it's working @arbex10 . Thank you very much!
hey bro, this code paste where?sorry my English not good
You should place it bottom on your master layout HTML page or whatever the HTML page you're trying to have the ADMIN LTE Sidebar.
just open a simple tag and put the code in there.
el código va dentro de un script en el pie de pagina antes de finalizar así:
this code insert into footer page...
Most helpful comment
Hello @jvbalcita
Can you test this, please: