Hash Link Offset

When you have a hash link on your page ( href=”#target” ) sometimes the browser scrolls too low and cuts off or puts too close to the top the target element.

You can offset this hash link by hooking into the ‘hashchange’ event.

This does NOT resolve linking directly to this hash tag, but will fix the on page hash link.

To do that you can setup the following functions.

Thanks to Eric Olsen over at stack overflow!