SOLVED: Sticky header "scrolling" class not set if going to hash anchors mid way down the page until scrolled

I managed to fix this on that link by adding this JS:

<script>
window.addEventListener('load', (event) => {
if(window.location.hash) {
var element = document.getElementById("bricks-header");
  element.classList.add("scrolling");
  element.classList.add("fixed");
}
});
</script>

This might not be the best way. Is there a better way?