我正在使用 AdminLTE 仪表板。在侧边栏 TreeView 菜单中,单击菜单后删除事件类。
最佳答案
将此 JavaScript 添加到页脚
*this works for adminlte sidebar menu and also for sidebar menu treeview
/** 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().siblings().removeClass('active').end().addClass('active');
// for treeview
$('ul.treeview-menu a').filter(function() {
return this.href == url;
}).parentsUntil(".sidebar-menu > .treeview-menu").siblings().removeClass('active').end().addClass('active');
关于javascript - AdminLTE 仪表板事件类删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44950774/