I got this script...
$(function(){
$('a[href*=#]:not([href=#])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'#')
|| location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({ scrollTop: target.offset().top }, 1000);
location.hash = (this.hash);
return false;
}
}
});
});
... But I have an issue with the page jumping to top when it scrolls, but if I take out the line...
location.hash = (this.hash);
It will work fine and scrolling is all good, but the URL doesn't append to the anchor links being clicked.
Basically I need the url to show: http://www.example.com/#home <-- note the hash.
Thanks in advance!