1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-11-03 02:13:16 +03:00

Fixed firefox tri-layout grid issue and added tablet sticky sidebar

- Fixed issue with original left-sidebar content being placed halfway
down the page.
- Added sticky sidebar to mid-size tablet layout, only for original left
sidebar items.

Fixes #1434.
This commit is contained in:
Dan Brown
2019-06-16 12:46:23 +01:00
parent f08668706f
commit bf1371d04c
3 changed files with 22 additions and 10 deletions

View File

@@ -74,14 +74,14 @@ class TriLayout {
* Used by the page-display component.
*/
showContent() {
this.showTab('content');
this.showTab('content', false);
}
/**
* Show the given tab
* @param tabName
*/
showTab(tabName) {
showTab(tabName, scroll = true) {
this.scrollCache[this.lastTabShown] = document.documentElement.scrollTop;
// Set tab status
@@ -96,12 +96,14 @@ class TriLayout {
this.elem.classList.toggle('show-info', showInfo);
// Set the scroll position from cache
const pageHeader = document.querySelector('header');
const defaultScrollTop = pageHeader.getBoundingClientRect().bottom;
document.documentElement.scrollTop = this.scrollCache[tabName] || defaultScrollTop;
setTimeout(() => {
if (scroll) {
const pageHeader = document.querySelector('header');
const defaultScrollTop = pageHeader.getBoundingClientRect().bottom;
document.documentElement.scrollTop = this.scrollCache[tabName] || defaultScrollTop;
}, 50);
setTimeout(() => {
document.documentElement.scrollTop = this.scrollCache[tabName] || defaultScrollTop;
}, 50);
}
this.lastTabShown = tabName;
}