jQuery Smooth Scroll
How to scroll to offset anchor links (4 posts)

  1. alliesev
    Posted 2 years ago #

    Hello, I'm wondering which code you would change so that the anchors are offset from the top of the page a bit. So when a user clicks on a link and the page scrolls down to the anchor... it doesn't quite scroll ALL the way down, so the anchor link remains about 300 px down from the top of the browser window.

    Thank you!


  2. natesimpson
    Posted 2 years ago #

    did you ever get an answer? I have tried several things myself and see others have same question...Please post your code edits if you have found a solution - I will do the same if i come up with one today!

  3. txie
    Posted 2 years ago #

    same problem here, anyone? thanks!

  4. AJ
    Posted 1 year ago #

    I got this working using a margin and padding offset attached to a class on the anchor. Change the numbers to fit the height of your heading.

    The HTML:

    <a class="offset" name="mission"></a>
    <a href="#top" title="Return to top">^</a>

    The CSS

    .offset {
        display: block;
        margin-top: -100px;
        padding-top: 100px;
        width: 1px;

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • jQuery Smooth Scroll
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic