How do I keep the child menu open when loaded?

前提是你 提交于 2020-01-06 23:44:48

问题


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?

A link to the theme is here: http://wrapbootstrap.com/preview/WB0JLR295

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.


回答1:


You can use e.stopPropagation()

This will prevent close of any 'dropdown-menu':

$('.dropdown-menu').on('click', function (e) {
    e.stopPropagation();
})

If you want only a specific dropdown you'd change the jQuery selector $('.dropdown-menu') accordingly.

Here is a working example



来源:https://stackoverflow.com/questions/16474551/how-do-i-keep-the-child-menu-open-when-loaded

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!