document.addEventListener('DOMContentLoaded', function() {
// Check if hash exists in the URL
if (window.location.hash) {
setTimeout(function() {
// Get the hash without the '#'
var hash = window.location.hash.slice(1);
// Get the position of the element with that id
var targetOffset = document.getElementById(hash).offsetTop;
// Scroll to the position of the element minus desired offset
window.scrollTo(0, targetOffset - 200);
}, 0);
}
});