Closed nslogx closed 6 years ago
I have add a sidebar in base_site.html, all views was extends the base_site.html,So, how can I keep the sidebar menu open when click sub menu, If anyone can help, I would be very wonderful, thanks
base_site.html
@almasaeed2010 @REJack
Please provide your code from sidebar.html too or a complete rendered version of the whole template.
code.zip @REJack here is the code of sidebar.html, base_site.html, thanks
Oh ok you need the active class on your sidebar entries, you can do this either through the Flask's templating engine Jinja2 they have a nice Highlighting Active Menu Items tutorial/example or you add a simple javascript with this lines:
/** 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');
@REJack Good job,Thanks
Thanks @REJack .. it works... Thank you so much
Oh ok you need the active class on your sidebar entries, you can do this either through the Flask's templating engine Jinja2 they have a nice Highlighting Active Menu Items tutorial/example or you add a simple javascript with this lines:
/** 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');
hello! I have the same problem, do as you say, but it still has no effect. here is my code `<!DOCTYPE html>
`
Hi, I was wondering how we can keep the parent directory open and highlight the current page we are on. Something like the link below: https://adminlte.io/themes/AdminLTE/pages/charts/flot.html
Thank You, Darius
Hello, Thanks for your greate job. I use adminLTE in my Flask project, but when I click sub menu, all menu will be refresh and closed, I have already spend too many time for this, please help me