mirror of https://github.com/ColorlibHQ/AdminLTE
Fix layout height computation
parent
945211f777
commit
71c560ec27
|
@ -64,10 +64,10 @@ var Layout = function ($) {
|
||||||
_createClass(Layout, [{
|
_createClass(Layout, [{
|
||||||
key: 'fixLayoutHeight',
|
key: 'fixLayoutHeight',
|
||||||
value: function fixLayoutHeight() {
|
value: function fixLayoutHeight() {
|
||||||
var heights = [$(window).height(), $(Selector.HEADER).outerHeight(), $(Selector.FOOTER).outerHeight()];
|
var heights = [$(window).height(), $(Selector.HEADER).outerHeight(), $(Selector.FOOTER).outerHeight(), $(Selector.SIDEBAR).height()],
|
||||||
|
max = this._max(heights);
|
||||||
|
|
||||||
$(Selector.CONTENT).css('min-height', heights[0] - (heights[1] + heights[2]));
|
$(Selector.CONTENT).css('min-height', max - (heights[1] + heights[2]));
|
||||||
console.log(heights[0] - (heights[1] + heights[2]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
|
@ -80,7 +80,7 @@ var Layout = function ($) {
|
||||||
$('body').removeClass(ClassName.HOLD);
|
$('body').removeClass(ClassName.HOLD);
|
||||||
|
|
||||||
this.fixLayoutHeight();
|
this.fixLayoutHeight();
|
||||||
$(Selector.SIDEBAR).on('collapsed.lte.treeview expanded.lte.treeview', function () {
|
$(Selector.SIDEBAR).on('collapsed.lte.treeview expanded.lte.treeview collapsed.lte.pushmenu expanded.lte.pushmenu', function () {
|
||||||
_this.fixLayoutHeight();
|
_this.fixLayoutHeight();
|
||||||
});
|
});
|
||||||
$(window).resize(function () {
|
$(window).resize(function () {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -13,9 +13,9 @@ const Layout = (($) => {
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const NAME = 'Layout'
|
const NAME = 'Layout'
|
||||||
const DATA_KEY = 'lte.layout'
|
const DATA_KEY = 'lte.layout'
|
||||||
const EVENT_KEY = `.${DATA_KEY}`
|
const EVENT_KEY = `.${DATA_KEY}`
|
||||||
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
const JQUERY_NO_CONFLICT = $.fn[NAME]
|
||||||
|
|
||||||
const Event = {
|
const Event = {
|
||||||
|
@ -56,13 +56,14 @@ const Layout = (($) => {
|
||||||
|
|
||||||
fixLayoutHeight() {
|
fixLayoutHeight() {
|
||||||
let heights = [
|
let heights = [
|
||||||
$(window).height(),
|
$(window).height(),
|
||||||
$(Selector.HEADER).outerHeight(),
|
$(Selector.HEADER).outerHeight(),
|
||||||
$(Selector.FOOTER).outerHeight()
|
$(Selector.FOOTER).outerHeight(),
|
||||||
]
|
$(Selector.SIDEBAR).height()
|
||||||
|
],
|
||||||
|
max = this._max(heights)
|
||||||
|
|
||||||
$(Selector.CONTENT).css('min-height', heights[0] - (heights[1] + heights[2]))
|
$(Selector.CONTENT).css('min-height', max - (heights[1] + heights[2]))
|
||||||
console.log(heights[0] - (heights[1] + heights[2]))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Private
|
// Private
|
||||||
|
@ -71,7 +72,7 @@ const Layout = (($) => {
|
||||||
$('body').removeClass(ClassName.HOLD)
|
$('body').removeClass(ClassName.HOLD)
|
||||||
|
|
||||||
this.fixLayoutHeight()
|
this.fixLayoutHeight()
|
||||||
$(Selector.SIDEBAR).on('collapsed.lte.treeview expanded.lte.treeview', () => {
|
$(Selector.SIDEBAR).on('collapsed.lte.treeview expanded.lte.treeview collapsed.lte.pushmenu expanded.lte.pushmenu', () => {
|
||||||
this.fixLayoutHeight()
|
this.fixLayoutHeight()
|
||||||
})
|
})
|
||||||
$(window).resize(() => {
|
$(window).resize(() => {
|
||||||
|
@ -116,7 +117,7 @@ const Layout = (($) => {
|
||||||
|
|
||||||
$.fn[NAME] = Layout._jQueryInterface
|
$.fn[NAME] = Layout._jQueryInterface
|
||||||
$.fn[NAME].Constructor = Layout
|
$.fn[NAME].Constructor = Layout
|
||||||
$.fn[NAME].noConflict = function () {
|
$.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT
|
$.fn[NAME] = JQUERY_NO_CONFLICT
|
||||||
return Layout._jQueryInterface
|
return Layout._jQueryInterface
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue