In the click event, you have access to the navigation element that you clicked on (this) and the target you are scrolling for ($ target). You can look at any of them to determine that you need to compensate for some amount other than -59.
If you have very few cases, you need to have a different offset, you can do this:
var offset = -59; if ($(this).attr(href)=="#something") offset=-100;
And change this line:
'scrollTop': $target.offset().top-59
:
'scrollTop': $target.offset().top+offset
If you want a more universal solution and access html, you can put the data attribute in either the <a> or the target element, for example
<a href="#something" data-scroll-offset=-100></a>
And then, similar to the first method:
var offset=-59; if ($(this).attr("data-scroll-offset")!==null) offset=$(this).attr("data-scroll-offset");
If it were on the target, it would be $ target instead of $ (this)
If you want to completely exclude a specific anchor, you can remove it from the anchor selector. Instead of this
$('a[href^="#"]')
Exclude only a specific anchor, for example:
$('a[href^="#"]:not([href="#somethingBad"])')
or exclude any anchors with a specific class, for example:
$('a[href^="#"]:not(.excludeMe)')