Update default.html

Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com>
This commit is contained in:
David Rotermund 2023-12-04 18:08:31 +01:00 committed by GitHub
parent de0239b29b
commit 7e18a17fb6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -290,6 +290,7 @@
var headerHeight = 200; // Height of the header var headerHeight = 200; // Height of the header
var footerHeight = 540; // Height of the footer var footerHeight = 540; // Height of the footer
var scrollTop = window.pageYOffset || document.documentElement.scrollTop; var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
var scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
var tocElement = document.querySelector('.toc-class'); var tocElement = document.querySelector('.toc-class');
if (scrollTop > headerHeight) { if (scrollTop > headerHeight) {
@ -297,6 +298,12 @@
} else { } else {
tocElement.style.top = headerHeight - scrollTop + 'px'; // Adjust based on scroll position tocElement.style.top = headerHeight - scrollTop + 'px'; // Adjust based on scroll position
} }
if (window.innerWidth > scrollLeft){
tocElement.style.display = 'block'; // Show the navigation bar
} else {
tocElement.style.display = 'none'; // Hide the navigation bar
}
}); });
</script> </script>