• Resolved extensis

    (@extensis)


    Looking at your #scroll-top button that scrolls the page smoothly back to top, I wish to add a link that scrolls the same to desired anchor.

    How to do that?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Theme Author oceanwp

    (@oceanwp)

    Hello,

    1. Add a custom ID in the section you want to scroll. For example “my-id”.
    2. In Appearance > Menus, create a custom menu item with url your ID so “#my-id” and add the text you want.

    When you will click on that link in your menu, you will be redirected smoothly to your section with the same ID.

    • This reply was modified 7 years, 6 months ago by oceanwp.
    Thread Starter extensis

    (@extensis)

    So smooth scroll is enabled by default? Interesting since it’s not working for me haha.

    I will try to remove certain JS code that fixes some strange behaviour on iPhone, I’m sure that code is disabling smooth scroll since it should be working transparently.

    I’ll get back with the result.

    Thread Starter extensis

    (@extensis)

    Oh yes, it’s my fault – as soon as the code was removed, smooth scrolling started working.

    Since I’m here already… Is there any way to add offset for smooth scroll?

    Theme Author oceanwp

    (@oceanwp)

    What do you mean for the “offset”?

    Thread Starter extensis

    (@extensis)

    Offset, popular with smooth scroll solutions out there. Script scrolls to diseride anchor but offsets scroll by desired value.

    Usually used in cases when there’s a fixed header on top of the page – without offset the header would cover the position of anchor.

    Detailed example: https://www.youtube.com/watch?v=bccfOoBztTk

    Theme Author oceanwp

    (@oceanwp)

    I thought you meant something else ??
    Yes the offset is automatically added depending on the size of the header (if using Ocean Sticky Header), top bar and admin bar.

    Thread Starter extensis

    (@extensis)

    Is there a way to manually control desired offset to a certain link? I’m not using standard header so that would be helpful ??

    If not, this will do just fine for now.

    Theme Author oceanwp

    (@oceanwp)

    There is no options like that, sorry.

    Thread Starter extensis

    (@extensis)

    Thank you for your help! ??

    Theme Author oceanwp

    (@oceanwp)

    You’re welcome ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Smooth scroll to anchor’ is closed to new replies.