其他分享
首页 > 其他分享> > adminlte2.4.18点击菜单,实现高亮不自动折叠

adminlte2.4.18点击菜单,实现高亮不自动折叠

作者:互联网

<script>
            $('.sidebar-menu li:not(.treeview) > a').on('click', function(){
                var $parent = $(this).parent().addClass('active');
                $parent.siblings('.treeview.active').find('> a').trigger('click');
                $parent.siblings().removeClass('active').find('li').removeClass('active');
            });

            $(window).on('load', function(){
                $('.sidebar-menu a').each(function(){
                    var cur = window.location.href;
                    var url = this.href;
                    if(cur.match(url)){
                        $(this).parent().addClass('active')
                            .closest('.treeview-menu').addClass('.menu-open')
                            .closest('.treeview').addClass('active');
                    }
                });
            });
        </script>

标签:高亮,parent,18,var,adminlte2.4,menu,active,treeview,addClass
来源: https://blog.csdn.net/qq_28482479/article/details/114694773