hugo-book icon indicating copy to clipboard operation
hugo-book copied to clipboard

Feature request: scroll active menu item into view

Open 5tm opened this issue 2 years ago • 0 comments

Hugo-book is a great theme, thanks for your hard-working @alex-shpak. Could you do me a favor. I want to make the active menu item auto scroll into view. I am not a programmer and I am not good at programming. After google, I got these script. function scroll(){ let e = document.querySelector( '.book-menu a.active' ); e.scrollIntoView({ behavior: 'smooth', block: 'center', inline: 'start' }) } setTimeout(scroll, 0); It worked, but it created more problem.

I like your no jquery idea, in my opinion javascript is convenient for developers but not for visitors, less javascript is more. I think this can be a useful feature. can you improve it?

5tm avatar Sep 19 '22 19:09 5tm