Javascript Smooth Scroll to Element

You know that special effect where you click on a link and your browser smoothly scrolls down to the appropriate section of the page? that is Javascript Smooth Scroll to Element.

Add this js code snippet in you js file and see the magic!

$(“a”).on(‘click’, function(event) {

if (this.hash !== “”) {

var hash = this.hash;

$(‘html, body’).animate({
scrollTop: $(hash).offset().top
}, 800, function(){

window.location.hash = hash;

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.