Update default.html
Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com>
This commit is contained in:
parent
a92cfc5dde
commit
fdfbb1a49e
1 changed files with 18 additions and 1 deletions
|
@ -283,6 +283,23 @@
|
||||||
</section>
|
</section>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</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>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in a new issue