I'm in the process of improving the functionality of my anchor links. I have a fixed header at the top of my page, so when you click on an anchor link elsewhere on the page, it jumps to that position with the anchor aligned at the top, leaving the fixed header covering part of the content.
The code below is doing what I intended, but there seems to be an issue with IE8. Clicking on a jump link causes it to go past the correct position rather than directly to it.
Any suggestions on how to fix this for IE8 compatibility?
<script>
! function(o, n) {
var t = function() {
var n = o(":target"),
t = 100;
if(n.length > 0){
o("html, body").stop().animate({
scrollTop: n.offset().top - t
}, 80)
}
};
o(n).on("hashchange load", function() {
t()
})
}(jQuery, window);
</script>