Ostatnio zastanawiałam się nad tym przy tworzeniu nawigacji na swojej stronie :) Wystarczy zapisać w zmiennej wysokość twojego menu (lub offset jaki chcesz , np 100px)
var headerHeight = $(".navigation").outerHeight();
a potem w funkcji przewijania, w animate odjąć tą wysokość
'scrollTop': $(target).offset().top - headerHeight
Cała funkcja do przewijania u mnie wygląda wygląda tak:
$(document).ready(function(){
//Get the header height
var headerHeight = $(".navigation").outerHeight();
$('.navigation a, .footer__link').on('click', function(e) {
e.preventDefault();
var target = $(this).attr("href");
$('html, body').stop().animate({
'scrollTop': $(target).offset().top - headerHeight
}, 900, 'swing', )
});
});