I am currently working on the development of a website that includes a fixed navigation bar. Check it out here:
In addition to the fixed navbar, there is also a "sticky" sidebar featuring links that act as anchors to specific content within the same page.
While everything seems to be functioning correctly, I've encountered an issue where clicking on one of these sidebar links causes the targeted content's title to be hidden behind the fixed navbar. Is there a way to implement an offset for these sidebar links to prevent this overlap?
I have attempted to address this problem by using the following code:
var offset = 380;
$('.sidebar-nav li a').click(function(event) {
event.preventDefault();
$($(this).attr('href'))[0].scrollIntoView();
scrollBy(0, +offset);
});
Unfortunately, this solution does not seem to work as expected, and it appears to initiate some unusual calculations from bottom to top instead.
If anyone has any guidance or suggestions on how to resolve this issue, I would greatly appreciate it!
Thank you in advance!