See the Pen One-pager navigation with intersectionObserver by Jules Colle (@pwkip) on CodePen.
Turn it into a reusable function, so we can also apply it on vertical secondary navigation.
See the Pen One-pager navigation with intersectionObserver by Jules Colle (@pwkip) on CodePen.