From a845699333e5faf41126bd4a8801a3ee531d921a Mon Sep 17 00:00:00 2001 From: Argo-Lenovo Date: Sat, 19 Nov 2016 13:49:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9BUG=EF=BC=9AiOS=E5=B0=8F?= =?UTF-8?q?=E5=B1=8F=E8=AE=BE=E5=A4=87=E7=AB=96=E5=B1=8F=E6=97=B6=E6=89=93?= =?UTF-8?q?=E5=BC=80=E4=BE=A7=E8=BE=B9=E6=A0=8F=E8=8F=9C=E5=8D=95=EF=BC=8C?= =?UTF-8?q?=E5=90=8E=E8=83=8C=E6=99=AF=E8=BF=87=E9=95=BF=E5=AF=BC=E8=87=B4?= =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=97=A0=E6=B3=95=E5=AE=8C=E5=85=A8=E9=81=AE?= =?UTF-8?q?=E7=9B=96=E4=BD=8F=E8=83=8C=E6=99=AF=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Content/css/admin-responsive.css | 4 ++++ Bootstrap.Admin/Content/css/admin.css | 10 +++------- Bootstrap.Admin/Content/js/common-scripts.js | 20 +++++++++++-------- Bootstrap.Admin/Views/Shared/_Admin.cshtml | 2 +- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/Bootstrap.Admin/Content/css/admin-responsive.css b/Bootstrap.Admin/Content/css/admin-responsive.css index 2869a06d..ebc2e2c0 100644 --- a/Bootstrap.Admin/Content/css/admin-responsive.css +++ b/Bootstrap.Admin/Content/css/admin-responsive.css @@ -26,6 +26,10 @@ margin-left: 0; } + #main-content.open { + display: none; + } + .modal-dialog { width: 540px; margin: 20px auto; diff --git a/Bootstrap.Admin/Content/css/admin.css b/Bootstrap.Admin/Content/css/admin.css index 1c186598..118dbafb 100644 --- a/Bootstrap.Admin/Content/css/admin.css +++ b/Bootstrap.Admin/Content/css/admin.css @@ -131,13 +131,9 @@ text-align: left; } -.sidebar-closed #main-content { - margin-left: 0; -} - -.sidebar-closed #sidebar { - display: none !important; -} + #main-content.closed { + margin-left: 0; + } #sidebar { width: 210px; diff --git a/Bootstrap.Admin/Content/js/common-scripts.js b/Bootstrap.Admin/Content/js/common-scripts.js index c128d876..8091455a 100644 --- a/Bootstrap.Admin/Content/js/common-scripts.js +++ b/Bootstrap.Admin/Content/js/common-scripts.js @@ -1,4 +1,7 @@ $(function () { + var $sidebar = $("#sidebar"); + var $main = $('#main-content'); + $('#nav-accordion').dcAccordion({ eventType: 'click', autoClose: true, @@ -20,21 +23,22 @@ $('#websiteFooter').text($('#footer').val()); - $('#sidebar').on('click', 'a', function () { + $sidebar.on('click', 'a', function () { var o = ($(this).offset()); diff = 300 - o.top; if (diff > 0) - $("#sidebar").scrollTo("-=" + Math.abs(diff), 500); + $sidebar.scrollTo("-=" + Math.abs(diff), 500); else - $("#sidebar").scrollTo("+=" + Math.abs(diff), 500); + $sidebar.scrollTo("+=" + Math.abs(diff), 500); }); - $('.sidebar-toggle-box').click(function () { - if ($('#sidebar').is(":visible") === true) { - $(".sidebar").addClass("sidebar-closed"); + $('.sidebar-toggle-box').on('click', function () { + if ($sidebar.is(":visible") === true) { + $sidebar.hide(); + $main.addClass('closed').removeClass('open'); } else { - $(".sidebar").removeClass("sidebar-closed"); - $("#sidebar").show(); + $sidebar.show(); + $main.addClass('open').removeClass('closed'); } }); diff --git a/Bootstrap.Admin/Views/Shared/_Admin.cshtml b/Bootstrap.Admin/Views/Shared/_Admin.cshtml index 197ac043..3c2d22d5 100644 --- a/Bootstrap.Admin/Views/Shared/_Admin.cshtml +++ b/Bootstrap.Admin/Views/Shared/_Admin.cshtml @@ -18,7 +18,7 @@ @RenderSection("Javascript", false) } -