Update default.html

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

View file

@ -283,6 +283,23 @@
</section>
</footer>
</div>
<!-- Add your script at the end of the body -->
<script>
window.addEventListener('scroll', function() {
var headerHeight = 200; // Height of the header
var footerHeight = 540; // Height of the footer
var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
var tocElement = document.querySelector('.toc-class');
if (scrollTop > headerHeight) {
tocElement.style.top = '0px'; // Stick to the top of the window
} else {
tocElement.style.top = headerHeight - scrollTop + 'px'; // Adjust based on scroll position
}
});
</script>
</body>
</html>