menu: scroll active item into view #79

This commit is contained in:
Sören Weber 2021-09-04 11:09:38 +02:00
parent 28450684a9
commit 1c6d9538a3
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589

View file

@ -111,6 +111,17 @@ function initMermaid() {
}
}
function scrollToActiveMenu() {
window.setTimeout(function(){
var e = $("#sidebar ul.topics li.active")[0];
if( e.scrollIntoView ){
e.scrollIntoView({
block: 'center',
});
}
}, 200);
}
// Get Parameters from some url
var getUrlParameter = function getUrlParameter(sPageURL) {
var url = sPageURL.split('?');
@ -210,6 +221,7 @@ $(window).resize(function() {
jQuery(function() {
restoreTabSelections();
initMermaid();
scrollToActiveMenu();
jQuery('#sidebar .category-icon').on('click', function() {
$( this ).toggleClass("fa-angle-down fa-angle-right") ;