Hey guys,
I need some quick point in the right direction. I have a fixed height of 80px and I have the following script that scrolls to a position on the page. However it does not add the desired offset of 80px to the top.
This is the jQuery snippet:
$('nav 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-100}, 1000);
$('body').animate({ scrollTop: target.offset().top + 80 }, 1000);
return false;
}
}
});
What am I missing?