Browse Source

add panelAutoHeightMode in Layout.js

REJack 4 years ago
parent
commit
563a91d15a
2 changed files with 11 additions and 9 deletions
  1. 8 7
      build/js/Layout.js
  2. 3 2
      docs/javascript/layout.md

+ 8 - 7
build/js/Layout.js

@@ -36,6 +36,7 @@ const Default = {
   scrollbarTheme: 'os-theme-light',
   scrollbarAutoHide: 'l',
   panelAutoHeight: true,
+  panelAutoHeightMode: 'min-height',
   loginRegisterAutoHeight: true
 }
 
@@ -81,15 +82,15 @@ class Layout {
 
     if (offset !== false) {
       if (max === heights.controlSidebar) {
-        $contentSelector.css('min-height', (max + offset))
+        $contentSelector.css(this._config.panelAutoHeightMode, (max + offset))
       } else if (max === heights.window) {
-        $contentSelector.css('min-height', (max + offset) - heights.header - heights.footer)
+        $contentSelector.css(this._config.panelAutoHeightMode, (max + offset) - heights.header - heights.footer)
       } else {
-        $contentSelector.css('min-height', (max + offset) - heights.header)
+        $contentSelector.css(this._config.panelAutoHeightMode, (max + offset) - heights.header)
       }
 
       if (this._isFooterFixed()) {
-        $contentSelector.css('min-height', parseFloat($contentSelector.css('min-height')) + heights.footer)
+        $contentSelector.css(this._config.panelAutoHeightMode, parseFloat($contentSelector.css(this._config.panelAutoHeightMode)) + heights.footer)
       }
     }
 
@@ -98,7 +99,7 @@ class Layout {
     }
 
     if (offset !== false) {
-      $contentSelector.css('min-height', (max + offset) - heights.header - heights.footer)
+      $contentSelector.css(this._config.panelAutoHeightMode, (max + offset) - heights.header - heights.footer)
     }
 
     if (typeof $.fn.overlayScrollbars !== 'undefined') {
@@ -123,8 +124,8 @@ class Layout {
     } else {
       const boxHeight = $selector.height()
 
-      if ($body.css('min-height') !== boxHeight) {
-        $body.css('min-height', boxHeight)
+      if ($body.css(this._config.panelAutoHeightMode) !== boxHeight) {
+        $body.css(this._config.panelAutoHeightMode, boxHeight)
       }
     }
   }

+ 3 - 2
docs/javascript/layout.md

@@ -14,9 +14,10 @@ This plugin is activated automatically upon window load.
 |---
 | Name | Type | Default | Description
 |-|-|-|-
-|scrollbarTheme | Boolean | `os-theme-light` | Scrollbar Theme used while SideBar Fixed
-|scrollbarAutoHide | Boolean | `l` | Scrollbar auto-hide trigger
+|scrollbarTheme | String | `os-theme-light` | Scrollbar Theme used while SideBar Fixed
+|scrollbarAutoHide | String | `l` | Scrollbar auto-hide trigger
 |panelAutoHeight | Boolean\|Numeric | true | Panel Height Correction (`true` = default correction on load/resize; numeric = offset the correction on load/resize)
+|panelAutoHeightMode | String | `min-height` | Panel Height Mode (`min-height` = sets the `min-height`-attribute to the content-wrapper; `height` = sets `height`-attribute to the content-wrapper)
 |loginRegisterAutoHeight | Boolean\|Integer | true | Login & Register Height Correction (`true` = single correction on load; integer = correction with a interval based on the interger)
 |---
 {: .table .table-bordered .bg-light}