加载后如何保持子菜单打开? [英] How do I keep the child menu open when loaded?
问题描述
我们正在使用一个名为"Acme Dashboard"的预制管理主题.当用户单击一个下拉子项并加载子页面时,在下一次加载时,菜单项会折叠.我们如何强制菜单在下次加载时保持打开状态?
we are using a pre-built admin theme called "Acme Dashboard." When the user clicks on a dropdown child and the child page loads, on the next load the menu item collapses. How can we force the menu to stay open on the next load?
到此主题的链接在这里: http://wrapbootstrap.com/preview/WB0JLR295
A link to the theme is here: http://wrapbootstrap.com/preview/WB0JLR295
我知道在加载子主题时,父主题被赋予class ="active"属性,但是我不知道在CSS/JS中要进行哪些更改以保持下拉菜单处于打开状态.
I understand that when the child theme is loaded, the parent is given the class="active" attribute, but I don't know what to change in the CSS/JS to keep the dropdown open.
推荐答案
您可以使用e.stopPropagation()
这将防止关闭任何下拉菜单":
This will prevent close of any 'dropdown-menu':
$('.dropdown-menu').on('click', function (e) {
e.stopPropagation();
})
如果只需要特定的下拉菜单,则可以相应地更改jQuery选择器$('.dropdown-menu')
.
If you want only a specific dropdown you'd change the jQuery selector $('.dropdown-menu')
accordingly.
这篇关于加载后如何保持子菜单打开?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!