mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
15 lines
426 B
JavaScript
15 lines
426 B
JavaScript
|
// Adds scroll position lock for default docs sidebar
|
||
|
|
||
|
if (document.querySelector('#sidebar-default') !== null) {
|
||
|
let sidebar = document.getElementById('sidebar-default');
|
||
|
|
||
|
let pos = sessionStorage.getItem('sidebar-scroll');
|
||
|
if (pos !== null) {
|
||
|
sidebar.scrollTop = parseInt(pos, 10);
|
||
|
}
|
||
|
|
||
|
window.addEventListener('beforeunload', () => {
|
||
|
sessionStorage.setItem('sidebar-scroll', sidebar.scrollTop);
|
||
|
});
|
||
|
}
|