mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
menu: scroll active item into view #79
This commit is contained in:
parent
28450684a9
commit
1c6d9538a3
1 changed files with 12 additions and 0 deletions
|
@ -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") ;
|
||||
|
|
Loading…
Reference in a new issue