fix toc menu

This commit is contained in:
anarsec 2024-04-14 14:26:54 +00:00
parent 40d727d8a3
commit 7daa9fe776
No known key found for this signature in database
2 changed files with 6 additions and 7 deletions

View file

@ -508,6 +508,10 @@ $footer-padding: 1.0rem 2.5rem
.navbar-end .navbar-end
flex-wrap: wrap!important flex-wrap: wrap!important
/* hide for 1023px instead of default 768px */
.is-hidden-mobile
display: none !important
html html
scroll-behavior: smooth scroll-behavior: smooth
@ -586,5 +590,5 @@ code
color: #AE3B8B color: #AE3B8B
.icon-text .icon-text
font-size: 18px font-size: 16px

View file

@ -29,13 +29,8 @@
const menuAbsTop = menuRect.top - bodyRect.top; const menuAbsTop = menuRect.top - bodyRect.top;
const elemAbsBottom = elemRect.bottom - bodyRect.top; const elemAbsBottom = elemRect.bottom - bodyRect.top;
const h = (window.innerHeight || document.documentElement.clientHeight); const h = (window.innerHeight || document.documentElement.clientHeight);
if(elemAbsBottom > menuAbsTop + h - 48 - bottomGap){
document.querySelector(".menu").style = "position: sticky; top: " + (menuAbsTop - elemAbsBottom + h - bottomGap).toString() + "px";
}
else{
document.querySelector(".menu").style = "position: sticky; top: 48px;"; document.querySelector(".menu").style = "position: sticky; top: 48px;";
} }
}
function activateIfVisible() { function activateIfVisible() {
let b = true; let b = true;