From dc847ea784b45df3cfc29379961fca2d50b8a5e6 Mon Sep 17 00:00:00 2001 From: zhizou Date: Thu, 22 Aug 2019 17:13:53 +0800 Subject: [PATCH] =?UTF-8?q?up:=20=E5=B7=A6=E4=BE=A7=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E5=B1=95=E5=BC=80=E5=8A=A8=E7=94=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/okadmin.css | 9 +++++++++ js/okadmin.js | 29 ++++++++++++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/css/okadmin.css b/css/okadmin.css index 8e6763e..2d2e5df 100644 --- a/css/okadmin.css +++ b/css/okadmin.css @@ -3,6 +3,15 @@ @import "../lib/fonts/myfont.css"; @import "../lib/nprogress/nprogress.css"; +#navBar .layui-nav-child{ + /*transition: height .5s;*/ + overflow: hidden; + padding: 5px 0!important; +} +#navBar .layui-nav-itemed .layui-nav-child, +#navBar .layui-nav-child dd{ + overflow: hidden; +} [class^="ok-icon"], [class*=" ok-icon"] { line-height: inherit; diff --git a/js/okadmin.js b/js/okadmin.js index 5077095..9af9b2a 100644 --- a/js/okadmin.js +++ b/js/okadmin.js @@ -25,7 +25,9 @@ layui.use(['element', 'layer', 'okUtils', 'okTab'], function () { if ($(this).siblings().length == 0) { okTab.tabAdd($(this)); } - $(this).parent("li").siblings().removeClass("layui-nav-itemed");//关闭其他的二级标签 + //关闭其他的二级标签 + $(this).parent("li").siblings().removeClass("layui-nav-itemed") + }); /** @@ -93,6 +95,31 @@ layui.use(['element', 'layer', 'okUtils', 'okTab'], function () { } }); + /**动画**/ + $("#navBar").on('click', '.layui-nav-item a', function () { + if (!$(this).attr('lay-id')) { + var superEle = $(this).parent(); + var ele = $(this).next('.layui-nav-child'); + var height = ele.height(); + if (superEle.is('.layui-nav-itemed')) { + ele.height(0); + ele.animate({ + height: height + 'px' + }, function () { + ele.removeAttr('style'); + }); + } else { + ele.css({'display':'block'}); + ele.animate({ + height: 0 + }, function () { + ele.removeAttr('style'); + ele.height('auto'); + }); + } + } + }); + /** * 全屏和退出全屏的方法 * @param num