- Code: Select all
if(this.hash !== '' && this.href.replace(this.hash, '') == window.location.href.replace(window.location.hash, '')) {
var target = jQuery(this.hash);
if(target.length && this.hash !== '#') {
jQuery('html, body').stop().animate({
'scrollTop': target.offset().top
}, 1000, 'swing', function () {
if(this.hash !== '#') {
window.location.hash = target.selector;
}
});
}
//Added this to redirect if no smooth scroll needed
} else {
window.location.href = this.href;
}
Another issue I have found, is that if I get an anchor in a link, the linked tag gets beneath the main menu row!
How can I fix this?
Thanks!