Universal jQuery scroll to div button

1 min read

Here is a little universal jQuery snippet that will allow you to create an anchor link that can scroll to any div on a page, or the top of the page. Remember to add the jQuery Easing plugin to your project too.

Here is the snippet –

So now say you wanted to scroll to a div with an id of ‘content’, you would simply create the following anchor –

And if you wanted to create an anchor that scrolled to the top of the page, you would do this –

Contact


Want to work with me or the Lab19 team? Great news! Reach me using the relevant links below: