Skip to content

Commit

Permalink
fixed scroll top bug in fixed layout mode
Browse files Browse the repository at this point in the history
  • Loading branch information
REJack committed Jul 8, 2019
1 parent f6a5d05 commit a1734ea
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
10 changes: 7 additions & 3 deletions build/js/Layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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'
});
}
}
}
};
Expand Down
10 changes: 7 additions & 3 deletions dist/js/adminlte.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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'
});
}
}
}
};
Expand Down
Loading

0 comments on commit a1734ea

Please sign in to comment.