• Resolved Nir Arad

    (@narad1972)


    When using anchor links to focus on a specific heading, it seems that the page header is not taken into account. This makes it look as if we scrolled to some place under the header, and requires scrolling back up to get to the intended position.

    Steps to recreate:
    1. Install the “Easy Table of Contents” plugin. This is used as the mechanism to create the anchors on the headings.
    2. Create a post with at least two headings (default configuration of the plugin shows the ToC only on posts with at least 2 headings).
    3. Add a link to one of the headings. For example if the heading is “heading”, the link content should be “#heading”.
    4. Preview the post and click on the link.

    Thank you!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Nir Arad

    (@narad1972)

    Note that my issue is with a sticky header that is “always sticky”. When I change it to “On scroll to top”, the problem disappears.

    Hi @narad1972,

    Try adding this CSS code to Appearance > Customize > Additional CSS from dashboard.

    @media only screen and (min-width: 1025px) {
      .ez-toc-section {
        scroll-padding-top: 170px;
      }  
    }
    Thread Starter Nir Arad

    (@narad1972)

    Hi @kharisblank !

    Thank you kindly for your reply!
    I tried it, and found that the scope was too restrictive.
    The following worked for me:

    @media only screen and (min-width: 1025px) {
    	html {
    		scroll-padding-top: var(--scroll-padding, 170px);
    	}
    }

    Kind regards,
    Nir

    Hi Nir,

    Thank you for getting back.

    Glad to know you got the simpler code that worked best for you.

    That said, may I request marking this topic as resolved? So you could raise a new topic for your other question that you might have. Thanks!

    Thread Starter Nir Arad

    (@narad1972)

    Yes, of course. I marked it now as resolved. Thanks again!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Problem with jumping to anchored links’ is closed to new replies.