<script>
$(function() {
var height = $("#pre-header-wrapper").outerHeight();
if ($("body").hasClass("logged-in")){
var heightLoggedin = $(".admin-navbar-collapse").outerHeight();
height += heightLoggedin;
}
height += 20;
if(window.location.hash) {
// smooth scroll to the anchor id
$('html, body').animate({
scrollTop: $(window.location.hash).offset().top - height
}, 1000);
}
$('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 - height
}, 1000);
return false;
}
}
});
});
</script>