WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. alliesev
    Member
    Posted 1 year 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!

    http://wordpress.org/extend/plugins/jquery-smooth-scroll/

  2. natesimpson
    Member
    Posted 1 year 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
    Member
    Posted 12 months ago #

    same problem here, anyone? thanks!

  4. AJ
    Member
    Posted 7 months 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:

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

    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

About this Topic