mirror of
https://github.com/davrot/pytutorial.git
synced 2025-06-06 22:00:01 +02:00
Update default.html
Signed-off-by: David Rotermund <54365609+davrot@users.noreply.github.com>
This commit is contained in:
parent
ede3d0e36a
commit
4623629913
1 changed files with 12 additions and 1 deletions
|
@ -167,6 +167,7 @@
|
||||||
width: 200px; /* Adjust as needed */
|
width: 200px; /* Adjust as needed */
|
||||||
height: 100%;
|
height: 100%;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
|
font-size: .55rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.toc-class ul ul {
|
.toc-class ul ul {
|
||||||
|
@ -292,12 +293,22 @@
|
||||||
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 tocElement = document.querySelector('.toc-class');
|
var tocElement = document.querySelector('.toc-class');
|
||||||
|
var windowHeight = window.innerHeight;
|
||||||
|
var docHeight = document.body.offsetHeight;
|
||||||
|
|
||||||
if (scrollTop > headerHeight) {
|
if (scrollTop > headerHeight) {
|
||||||
tocElement.style.top = '0px'; // Stick to the top of the window
|
tocElement.style.top = '20px'; // Stick to the top of the window
|
||||||
} 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 (scrollTop + windowHeight > (docHeight - footerHeight)) {
|
||||||
|
// We are in the region of the footer
|
||||||
|
tocElement.style.height = (docHeight - scrollTop - footerHeight) + 'px';
|
||||||
|
} else {
|
||||||
|
tocElement.style.height = '100%';
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
window.addEventListener('resize', function() {
|
window.addEventListener('resize', function() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue