Skip to content
Snippets Groups Projects
Commit 65d97805 authored by utkarsh_33's avatar utkarsh_33 Committed by Lauri Timmanee
Browse files

Issue #3375854: Scroll the sidebar to the active item when loading the page

parent abd63a6b
No related branches found
No related tags found
No related merge requests found
......@@ -124,6 +124,11 @@ document.addEventListener("DOMContentLoaded", function () {
linkElements = linkElements.parentElement;
}
expandSidebar();
const expandedTray = document.querySelector('.menu-item.menu-item--expanded');
if (expandedTray) {
const sidebar = document.getElementById('navigation-sidebar');
const trayOffset = expandedTray.getBoundingClientRect().top - sidebar.getBoundingClientRect().top;
sidebar.scrollTo({top:trayOffset, behavior: "smooth"});
}
}
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment