mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-02-17 09:10:08 +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
|
// Get Parameters from some url
|
||||||
var getUrlParameter = function getUrlParameter(sPageURL) {
|
var getUrlParameter = function getUrlParameter(sPageURL) {
|
||||||
var url = sPageURL.split('?');
|
var url = sPageURL.split('?');
|
||||||
|
@ -210,6 +221,7 @@ $(window).resize(function() {
|
||||||
jQuery(function() {
|
jQuery(function() {
|
||||||
restoreTabSelections();
|
restoreTabSelections();
|
||||||
initMermaid();
|
initMermaid();
|
||||||
|
scrollToActiveMenu();
|
||||||
|
|
||||||
jQuery('#sidebar .category-icon').on('click', function() {
|
jQuery('#sidebar .category-icon').on('click', function() {
|
||||||
$( this ).toggleClass("fa-angle-down fa-angle-right") ;
|
$( this ).toggleClass("fa-angle-down fa-angle-right") ;
|
||||||
|
|
Loading…
Add table
Reference in a new issue