8a40e22691
Add a custom JavaScript file to all HTML rendered docs output. For now it only hosts a small code snipped which gets the current active section link and bring it into view. Needs to be triggered after DOM is initially loaded (which is still before *all* resources like images, iframes, ... are necessarily loaded), else the query cannot work. Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
8 lines
295 B
JavaScript
8 lines
295 B
JavaScript
window.addEventListener('DOMContentLoaded', (event) => {
|
|
let activeSection = document.querySelector("a.current");
|
|
if (activeSection) {
|
|
// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
|
|
activeSection.scrollIntoView({ block: 'center' });
|
|
}
|
|
});
|