diff --git a/js/main.js b/js/main.js index 8bdb4bd021..53e66154be 100644 --- a/js/main.js +++ b/js/main.js @@ -9,4 +9,19 @@ function setCounter () { $('#counter').html( daysToGo() + " Days to go" ); } -$( document ).ready( setCounter ); +$( document ).ready(function() { + setCounter; + + $('a[href^="#"]').on('click',function (e) { + e.preventDefault(); + + var target = this.hash; + var $target = $(target); + + $('html, body').stop().animate({ + 'scrollTop': $target.offset().top + }, 900, 'swing', function () { + window.location.hash = target; + }); + }); +} );