1
0
mirror of https://github.com/minio/docs.git synced 2025-07-27 08:41:57 +03:00

Fix sidebar scroll and menu z-index (#587)

This commit is contained in:
Rushan
2022-09-29 23:04:21 +04:00
committed by GitHub
parent c3a1e501d9
commit 373fde9ca2
6 changed files with 37 additions and 65 deletions

View File

@ -21,16 +21,26 @@ window.addEventListener("DOMContentLoaded", (event) => {
const sidebarEl = document.querySelector(".sidebar");
const headerEl = document.querySelector(".header");
const activeDocEl = document.querySelector(".docs a.current");
const tocEl = document.querySelector(".content__toc");
function setSidebarHeight() {
function setSidebarHeight() { //TODO: Clean this up
var headerViewHeight = headerEl.clientHeight - root.scrollTop;
var sidebarHeight = headerViewHeight > 0 ? `calc(100vh - ${headerViewHeight}px)` : "100vh";
var sidebarReadModeHeight = window.innerWidth > 991 ? sidebarHeight : "100vh";
if(!root.classList.contains("read-mode")) {
var headerViewHeight = headerEl.clientHeight - root.scrollTop;
var sidebarHeight = headerViewHeight > 0 ? `calc(100vh - ${headerViewHeight}px)` : "100vh";
sidebarEl.style.setProperty("height", sidebarHeight);
tocEl.style.setProperty("height", sidebarHeight);
}
else {
sidebarEl.style.removeProperty("height");
sidebarEl.style.setProperty("height", sidebarReadModeHeight);
if(window.innerWidth > 991) {
tocEl.style.setProperty("height", sidebarReadModeHeight);
}
else {
tocEl.style.removeProperty("height");
}
}
}