Browse Source

fixed scroll top bug in fixed layout mode

REJack 5 years ago
parent
commit
a1734eabda
3 changed files with 14 additions and 6 deletions
  1. 7 3
      build/js/Layout.js
  2. 7 3
      dist/js/adminlte.js
  3. 0 0
      dist/js/adminlte.min.js

+ 7 - 3
build/js/Layout.js

@@ -23,6 +23,8 @@
     layoutBoxed   : '.layout-boxed',
     mainFooter    : '.main-footer',
     mainHeader    : '.main-header',
+    mainSidebar   : '.main-sidebar',
+    slimScrollDiv : 'slimScrollDiv',
     sidebar       : '.sidebar',
     controlSidebar: '.control-sidebar',
     fixed         : '.fixed',
@@ -130,9 +132,11 @@
         // $(Selector.sidebar).slimScroll({ destroy: true }).height('auto')
 
         // Add slimscroll
-        $(Selector.sidebar).slimScroll({
-          height: ($(window).height() - $(Selector.mainHeader).height()) + 'px'
-        });
+        if ($(Selector.mainSidebar).find(Selector.slimScrollDiv).length === 0) {
+          $(Selector.sidebar).slimScroll({
+            height: ($(window).height() - $(Selector.mainHeader).height()) + 'px'
+          });
+        }
       }
     }
   };

+ 7 - 3
dist/js/adminlte.js

@@ -986,6 +986,8 @@ throw new Error('AdminLTE requires jQuery')
     layoutBoxed   : '.layout-boxed',
     mainFooter    : '.main-footer',
     mainHeader    : '.main-header',
+    mainSidebar   : '.main-sidebar',
+    slimScrollDiv : 'slimScrollDiv',
     sidebar       : '.sidebar',
     controlSidebar: '.control-sidebar',
     fixed         : '.fixed',
@@ -1093,9 +1095,11 @@ throw new Error('AdminLTE requires jQuery')
         // $(Selector.sidebar).slimScroll({ destroy: true }).height('auto')
 
         // Add slimscroll
-        $(Selector.sidebar).slimScroll({
-          height: ($(window).height() - $(Selector.mainHeader).height()) + 'px'
-        });
+        if ($(Selector.mainSidebar).find(Selector.slimScrollDiv).length === 0) {
+          $(Selector.sidebar).slimScroll({
+            height: ($(window).height() - $(Selector.mainHeader).height()) + 'px'
+          });
+        }
       }
     }
   };

File diff suppressed because it is too large
+ 0 - 0
dist/js/adminlte.min.js


Some files were not shown because too many files changed in this diff