= 1024) {
head.style.top = '';
head.classList.remove('actec-header-away');
}
"
@scroll.window.passive="
const head = $el.closest('.page-header');
if (head && window.innerWidth < 1024) {
const y = window.scrollY;
// the reference point moves only when the header switches, so a slow scroll up adds up; the first event
// (also after a restored position or an anchor jump) sets it
if (head.actecAnchorY === undefined) {
head.actecAnchorY = y;
}
const anchor = head.actecAnchorY;
if (y <= head.offsetHeight) {
head.style.top = '0px';
head.classList.remove('actec-header-away');
head.actecAnchorY = y;
} else if (y > anchor + 4) {
if (!head.classList.contains('actec-header-away')) {
head.style.top = (-head.offsetHeight) + 'px';
head.classList.add('actec-header-away');
}
head.actecAnchorY = y;
} else if (y < anchor - 4) {
// back in the page only the header itself returns, the bar above it (offsetTop) stays out
if (head.classList.contains('actec-header-away') || head.style.top === '') {
head.style.top = (-$el.offsetTop) + 'px';
head.classList.remove('actec-header-away');
}
head.actecAnchorY = y;
}
} else if (head) {
head.style.top = '';
head.classList.remove('actec-header-away');
}
"
>