Hello,
I am using the #Id in links to scroll the page down to the related content. Unfortunately the fixed header at the top of the page covers the content up. In this case what I am doing is using the Id in a H1, H2, etc, element as the scroll to. So localhost#Target.
I am trying to get the page to scroll down the height of the header with the following:
document.addEventListener("DOMContentLoaded",()=>{
if (window.location.href.includes('#')) {
document.querySelector('body').style.height = '';
document.querySelector('html').style.height = '';
document.querySelector('html').style.overflow = '';
setTimeout(()=>{
const locArr = window.location.href.split(/\#/g);
const offSet = document.querySelector('#' + locArr[1]).offsetTop;
window.body.scrollTo({ top : offSet + 187 });
},500);
}
});
I can’t get it to work. Research indicates that the issue is related to Body height and HTML height set to 100%.
I am hoping The Wizards at Themeco (that’s you guys) can help with this issue.
Thank you,
b
