Before I get flamed with references to manuals, I have been researching this for quite some time, and keep getting dead ends. Not even sure how to debug it properly. So if
$('a.js-hash').click(function() {
// Store hash
var hash = this.hash;
// Using jQuery's animate() method to add smooth page scroll
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 1000, function() {
// Add hash (#) to URL when done scrolling (default click behavior)
window.location.hash = hash;
});
// Prevent default anchor click behavior
return false;
});