  $(document).ready(function(){
    // Add smooth scrolling to all links with #
    $("a").on('click', function(event) {
      if (this.hash !== "") {

        // Prevent default anchor click behavior
        event.preventDefault();
  
        // Store hash
        var hash = this.hash;
  
        $('html, body').animate({
          scrollTop: $(hash).offset().top
        }, 1000, function(){
             // Add hash (#) to URL when done scrolling (default click behavior)
        window.location.hash = hash;
    });
  } // End if
});
});