Smooth Scroll Effect to anchor – jQuery

Add a smooth scroll effect to an anchor with this simple jQuery snippet.

You need to define a link and then an item with the anchor ID.

In the example below it uses a class to identify the link. You could remove it or change it to your needs.

Tags:

6 Responses to “Smooth Scroll Effect to anchor – jQuery”

  1. Gui May 13, 2012 at 6:24 pm #

    Many thanks for this code 🙂

    • Rick May 13, 2012 at 10:53 pm #

      You’re welcome!

  2. Alex van Winkel January 16, 2014 at 3:10 pm #

    Hi !

    Stupid question probably, but I’m new to JavaScript…

    Where do I put the second part of code ?

    I mean this part :

    Thanks ! Alex

    • Rick January 16, 2014 at 7:45 pm #

      At the bottom of the file between script tags, like so:

      • Alex van Winkel January 16, 2014 at 9:40 pm #

        Yup ! That’s it !

        Thanks for helping this newbie 😉

      • Rick January 16, 2014 at 10:43 pm #

        Glad it worked, happy coding!

Leave a Reply

Add <code> Some Code </code> by using this tags.