Site logo

Archived topic

Jumping to an Anchor on Another Page or Post below the HTML Anchor

1 reply · Started by Marcel on July 14, 2020

Viewing posts 1–2 of 2

Hello,
I understand that using "smooth-scroll" can only be done on the same page and, in my case, it works absolutely well. The problem is that I want to use an HTML's anchor to jump to another page's anchor. In my case, I jump to the new page, but immediately below HTML Anchor.
How do I jump exactly where the title is (H2 in my case) and not immediately below the title?
REFERENCES: https://wordpress.org/support/article/page-jumps/ and
https://make.wordpress.org/support/user-manual/content/pages/page-jumps/#jumping-to-an- Another anchor-on-page-or-post.
Here is a short video recording, to explain better my issue. Sorry about the sound, I should turn off the microphone, but I forgot.
Thank you!

Hi there,

This is an issue when using a sticky element and anchors, unfortunately.

There are certain CSS things you can try: https://stackoverflow.com/questions/10732690/offsetting-an-html-anchor-to-adjust-for-fixed-header

Something like this may be worth trying: https://stackoverflow.com/a/24298427/2391422

.entry-content [id]::before {
  content: '';
  display: block;
  height:      75px; /* height of your sticky nav */
  margin-top: -75px; /* height of your sticky nav */
  visibility: hidden;
}
This archived topic is closed to new replies.