khusika / FeelIt

A clean, elegant but advanced blog theme for Hugo
https://feelit.khusika.dev
MIT License
164 stars 60 forks source link

[BUG] Anchor links scroll to wrong Y offset #66

Closed MarcoSantarossa closed 2 years ago

MarcoSantarossa commented 2 years ago

Describe the bug

When you click an anchor link like https://feelit.khusika.com/theme-documentation-basics/#22-install-the-theme, the page Y offset is not correct and it doesn't show the title of the anchor but the title goes underneath the header.

Expected behavior

I would expect to se the title of the anchor visible, therefore we the correct page content Y offset.

Screenshots

Screenshot 2021-09-08 at 22 40 59

Build Environment

The one at https://feelit.khusika.com/theme-documentation-basics/#22-install-the-theme

Please try to use Hugo extended version before opening the issue.

Preview Environment

Additional Information

I believe we need to take in consideration the height of the fixed header when we want to handle the scroll to link anchor Y offset.

khusika commented 2 years ago

Confirmed and i'm still looking for workaround of this.

MarcoSantarossa commented 2 years ago

Confirmed and i'm still looking for workaround of this.

Maybe you've already tried but this might be a solution to consider https://spigotdesign.com/smooth-scroll-offset-anchor-links-with-css/#smooth-scroll. StackOverflow gives similar solutions.

khusika commented 2 years ago

Confirmed and i'm still looking for workaround of this.

Maybe you've already tried but this might be a solution to consider https://spigotdesign.com/smooth-scroll-offset-anchor-links-with-css/#smooth-scroll. StackOverflow gives similar solutions.

Brilliant, that's what i looking for. Thanks for this