@@ -354,10 +354,12 @@ window.addEventListener("scroll", event => {
354354
355355 all.forEach(link => {
356356 let section = document.querySelector(link.hash);
357+ let sectionChildren = document.querySelector(link.hash).nextElementSibling;
357358
358359 if (
359− section.offsetTop <= fromTop &&
360− section.offsetTop + section.offsetHeight > fromTop
360+ ((section.offsetTop <= fromTop) ||
361+ (sectionChildren.offsetTop <= fromTop)) &&
362+ (section.offsetTop + section.offsetHeight + sectionChildren.offsetHeight > fromTop)
361363 ) {
362364 link.classList.add("current");
363365 } else {