Issue with linking anchors within the same page


#1

Hi all!
I am working on my personal portfolio page, of course there is pleny of work to do here,but I am having one issue that I am struggling to try to solve.

I am doing some internal links to jump to sections,but how can I make possible for the link to point to each section without every time cutting the heading of it?

I hope that I’ve been clear enough to explain the issue,thank you for your help!

The website is www.marcocaramaschi.com


#2

I think you may have a better chance of getting a response if you put your code in a familiar location. (Github, Codepen, JSFiddle, etc) Me, and some others out there, aren’t super comfortable visiting servers we’ve never heard of before.

With that said, I’m going to make a guess that you’re hitting this issue: Navbar hides initial content when jumping to in-page anchor

It’s a common issue when using a fixed navbar (with or without bootstrap involved). This is what I use in my JavaScript to work around the issue:

// -55 compensates for 55px navbar height, modify as needed
window.addEventListener("hashchange", () => scrollBy(0, -55));

But, read that link above to see if there is another solution you prefer. Also, see this related topic:


#3

Thank you so much SkyC, that little bit of Javascript actually solved my problem! I will put a link from codepen next time, thank you for taking time to review my site anyway! Can I ask you if you have any feedback about it as well? Thank you again!