Browse Source

修复浏览器手动缩放比例后菜单无法自适应问题

RuoYi 4 years ago
parent
commit
7dc982aded

+ 3 - 3
ruoyi-admin/src/main/resources/static/css/style.css

@@ -865,9 +865,9 @@ body.canvas-menu.mini-navbar nav.navbar-static-side {
     color: #cacaca;
 }
 
-/* .form-control, .form-control:focus, .has-error .form-control:focus,  .has-success .form-control:focus, .has-warning .form-control:focus,  .navbar-collapse, .navbar-form, .navbar-form-custom .form-control:focus,  .navbar-form-custom .form-control:hover, .open .btn.dropdown-toggle,  .panel, .popover, .progress, .progress-bar { */
-/*     box-shadow: none; */
-/* } */
+.form-control, .has-error .form-control:focus,  .has-success .form-control:focus, .has-warning .form-control:focus,  .navbar-collapse, .navbar-form, .navbar-form-custom .form-control:focus,  .navbar-form-custom .form-control:hover, .open .btn.dropdown-toggle,  .panel, .popover, .progress, .progress-bar {
+    box-shadow: none;
+}
 
 .btn-outline {
     color: inherit;

+ 16 - 5
ruoyi-admin/src/main/resources/static/ruoyi/index.js

@@ -7,7 +7,7 @@ layer.config({
     skin: 'layer-ext-moon'
 });
 
-var isMobile = $.common.isMobile() || $(window).width() < 769;
+var isMobile = false;
 var sidebarHeight = isMobile ? '100%' : '96%';
 
 $(function() {
@@ -52,12 +52,23 @@ $(function() {
 
 });
 
-$(window).bind("load resize",
-function() {
-    if ($(this).width() < 769) {
+$(window).bind("load resize", function() {
+    isMobile = $.common.isMobile() || $(window).width() < 769;
+    if (isMobile) {
         $('body').addClass('canvas-menu');
+        $("body").removeClass("mini-navbar");
         $("nav .logo").addClass("hide");
-        $(".slimScrollDiv").css({ "overflow":"hidden" })
+        $(".slimScrollDiv").css({ "overflow": "hidden" });
+        $('.navbar-static-side').fadeOut();
+    } else {
+    	if($('body').hasClass('canvas-menu')) {
+	        $('body').addClass('fixed-sidebar');
+	        $('body').removeClass('canvas-menu');
+	        $("body").removeClass("mini-navbar");
+	        $("nav .logo").removeClass("hide");
+	        $(".slimScrollDiv").css({ "overflow": "visible" });
+	        $('.navbar-static-side').fadeIn();
+    	}
     }
 });