• Resolved sswebdeval

    (@sswebdeval)


    Hello, I have sticky elements that fix to the top of the screen when scrolling down a page. When clicking a linked element in the Table of contents, the anchored text gets hidden behind the fixed elements. Is there a hook or offset I can apply to the plugin settings to allow me to accommodate certain theme elements that fix to the screen on scroll?

Viewing 1 replies (of 1 total)
  • Thread Starter sswebdeval

    (@sswebdeval)

    I resolved this. For anyone needing a quick fix, you can use the CSS scroll-margin-top property to define the top margin of the scroll snap area for an element. Add this to your theme code or a one-off HTML block inside a <style></style> element to control the offset of the scroll.

    https://caniuse.com/?search=scroll-margin-top

    Example:
    <style>
    h2, h3 {
    scroll-margin-top: 300px;
    }
    </style>

    • This reply was modified 9 months, 4 weeks ago by sswebdeval.
Viewing 1 replies (of 1 total)

The topic ‘Sticky/Fixed elements on scroll + anchor linking’ is closed to new replies.