From 563a91d15ae2fdbf5f707638fbbd0121faf974fb Mon Sep 17 00:00:00 2001 From: REJack Date: Sat, 19 Sep 2020 14:15:59 +0200 Subject: [PATCH] add panelAutoHeightMode in Layout.js --- build/js/Layout.js | 15 ++++++++------- docs/javascript/layout.md | 5 +++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/build/js/Layout.js b/build/js/Layout.js index 773c4eb22..88b442653 100644 --- a/build/js/Layout.js +++ b/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) } } } diff --git a/docs/javascript/layout.md b/docs/javascript/layout.md index 1b1e248c3..289ae9e9f 100644 --- a/docs/javascript/layout.md +++ b/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}