jQuery网站管理后台左侧边展开收缩图标菜单代码

[复制链接]
查看1333 | 回复0 | 2021-2-22 11:28 | 显示全部楼层 |阅读模式

jQuery网站管理后台左侧边展开收缩图标菜单代码

jQuery网站管理后台左侧边展开收缩图标菜单代码

jQuery网站管理后台左侧边展开收缩图标菜单代码是一款侧边栏下拉菜单,支持收缩起来只显示图标,或展开显示图标和文字菜单。
  1. js代码

  2. <script type="text/javascript">
  3. $(document).ready(function(){
  4.     //展开收起
  5.     $(".btn-nav").click(function () {
  6.       $(".lvc-wrap").toggleClass("lvc-close")
  7.       $("ol").toggleClass("small-ol")
  8.       $(".next-layer ol").hide()

  9.       if($("#lvc-nav").hasClass('lvc-close')){
  10.         $(".next-layer ").removeClass("arrow")
  11.       }
  12.     })

  13.     //选中状态
  14.     $(".lvc-nav li").click(function () {
  15.       $(this).siblings().find('ol').hide()
  16.       $(this).addClass("active").siblings().removeClass("active")
  17.     })

  18.     //选中子集清除父级active
  19.     $("ol>li").click(function (e) {
  20.       console.log('ol>li clicked')
  21.       e.stopPropagation()
  22.      $(this).parent().parent().removeClass("active")
  23.     })

  24.     //二级导航展开收起
  25.     $(".next-layer").click(function () {
  26.       $(this).children("ol").toggle();
  27.       $(this).toggleClass("arrow").siblings().removeClass("arrow")
  28.     })


  29.      $("ol li").click(function () {
  30.        if($("ol").hasClass('small-ol')) {
  31.          $(".small-ol").hide();
  32.          $(this).parent().parent().addClass("active")
  33.        }
  34.      })
  35. })
  36. </script>
复制代码


jQuery网站管理后台左侧边展开收缩图标菜单代码.zip (48.07 KB, 下载次数: 441)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

UID
436
贡献
4
丢币
318
主题
163
回帖
1
注册时间
2021-2-21
最后登录
2023-3-12