Disclaimer: This article is a blogger original article, shall not be reproduced without the bloggers allowed. https://blog.csdn.net/lm9521/article/details/86541049
layui official documents in version 2.2.6 which has increased the Lay-Shrink = "All" , for opening: When you expand a submenu, shrink sibling has launched a sub-menu.
See below, the official website Description: https://www.layui.com/doc/base/changelog.html
html page use:
<ul class="layui-nav layui-nav-tree" lay-shrink="all">
</ul>
Implementation of the two:
html page:
<ul class="layui-nav layui-nav-tree" lay-shrink="all">
<li class="layui-nav-item layui-nav-itemed">
...
</li>
</ul>
js:
$('.layui-nav-item').click(function(){
$(this).siblings('li').attr('class','layui-nav-item');
})