From 9f01d7a88a1ed4ca29f57cd5f5c5d4043b52fcbf Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Sat, 19 Nov 2016 13:07:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DBUG=EF=BC=9A=E5=89=8D?= =?UTF-8?q?=E5=8F=B0=E9=A1=B5=E9=9D=A2=E8=B7=B3=E8=BD=AC=E6=97=B6=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E6=B2=A1=E6=9C=89=E6=AD=A3=E7=A1=AE=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?active=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bootstrap.Admin/Bootstrap.Admin.csproj | 1 - Bootstrap.Admin/Content/css/site.css | 10 +++------- Bootstrap.Admin/Scripts/Content.js | 22 ++++++++++++++------- Bootstrap.Admin/Views/Home/Index.cshtml | 4 +++- Bootstrap.Admin/Views/Shared/Content.cshtml | 4 ---- Bootstrap.Admin/Views/Shared/Header.cshtml | 4 ++-- Bootstrap.Admin/Views/Shared/SubMenu.cshtml | 2 +- 7 files changed, 24 insertions(+), 23 deletions(-) delete mode 100644 Bootstrap.Admin/Views/Shared/Content.cshtml diff --git a/Bootstrap.Admin/Bootstrap.Admin.csproj b/Bootstrap.Admin/Bootstrap.Admin.csproj index 80a1792d..a03282c9 100644 --- a/Bootstrap.Admin/Bootstrap.Admin.csproj +++ b/Bootstrap.Admin/Bootstrap.Admin.csproj @@ -303,7 +303,6 @@ - diff --git a/Bootstrap.Admin/Content/css/site.css b/Bootstrap.Admin/Content/css/site.css index 8733915c..907bbf46 100644 --- a/Bootstrap.Admin/Content/css/site.css +++ b/Bootstrap.Admin/Content/css/site.css @@ -514,10 +514,6 @@ a, a:hover, a:focus { margin-bottom: 14px; } - .dropdown-menu.menu .menu-submenu li p.active { - color: #FF6C60; - } - .dropdown-menu.menu .menu-submenu li a { margin-bottom: 15px; display: inline-block; @@ -525,12 +521,12 @@ a, a:hover, a:focus { font-size: 13px; } - .dropdown-menu.menu .menu-submenu li a.active { - color: #FF6C60; + .dropdown-menu.menu .menu-submenu li a.active, .dropdown-menu.menu .menu-submenu li p.active { + color: #0376d8; } .dropdown-menu.menu .menu-submenu li a:hover { - color: #FF6C60; + color: #2e6da4; } .dropdown-menu.menu .menu-submenu li a i { diff --git a/Bootstrap.Admin/Scripts/Content.js b/Bootstrap.Admin/Scripts/Content.js index a862f746..e3d37df5 100644 --- a/Bootstrap.Admin/Scripts/Content.js +++ b/Bootstrap.Admin/Scripts/Content.js @@ -1,6 +1,5 @@ $(function () { $('#navbar').attr('data-toggle', "dropdown").addClass('dropdown-toggle'); - function iframeResposive() { try { var fra = $('iframe').get(0); @@ -12,13 +11,22 @@ $(window).on('load', iframeResposive); $(window).on('resize', iframeResposive); - $('.menu-submenu a').click(function (event) { - var act = $(this).attr("data-act"); + var $subMenu = $('#submenu'); + $subMenu.on('click', 'a', function (event) { + var $this = $(this); + var act = $this.attr("data-act"); if (act === "True") return true; event.preventDefault(); - $('.menu-submenu a, .menu-submenu p').removeClass('active'); - $(this).addClass('active'); - $(this).parents("ul").first().find('p').addClass('active'); - $('iframe').attr('src', $(this).attr('href')); + $subMenu.find('p, a').removeClass('active'); + setActive($this); + $('iframe').attr('src', $this.attr('href')); }); + $subMenu.find('a').each(function (index, ele) { + var $this = $(this); + if ($this.attr('href') == window.location.pathname) setActive($this); + }); + function setActive(ele) { + ele.addClass('active'); + ele.parents("ul").first().find('p').addClass('active'); + } }); \ No newline at end of file diff --git a/Bootstrap.Admin/Views/Home/Index.cshtml b/Bootstrap.Admin/Views/Home/Index.cshtml index 4227683a..4cef9b0e 100644 --- a/Bootstrap.Admin/Views/Home/Index.cshtml +++ b/Bootstrap.Admin/Views/Home/Index.cshtml @@ -8,4 +8,6 @@ @section header { @Html.Partial("Header", Model) } -@Html.Partial("Content", Model) \ No newline at end of file +
+ +
\ No newline at end of file diff --git a/Bootstrap.Admin/Views/Shared/Content.cshtml b/Bootstrap.Admin/Views/Shared/Content.cshtml deleted file mode 100644 index c4551d53..00000000 --- a/Bootstrap.Admin/Views/Shared/Content.cshtml +++ /dev/null @@ -1,4 +0,0 @@ -@model ContentModel -
- -
diff --git a/Bootstrap.Admin/Views/Shared/Header.cshtml b/Bootstrap.Admin/Views/Shared/Header.cshtml index f66ce9c6..15cb3c1d 100644 --- a/Bootstrap.Admin/Views/Shared/Header.cshtml +++ b/Bootstrap.Admin/Views/Shared/Header.cshtml @@ -9,10 +9,10 @@ @if (Model.Menus.Count() > 0 && Model.ShowMenu) { -