Opens in a new tab
let lastScrollPosition = 0;
const headerWrapper = document.querySelector('#header-wrapper'); // Changed selector
const scrollThreshold = 100;

function getTranslateValue() {
    return window.innerWidth <= 477 ? -38 : -60;
}

window.addEventListener('scroll', () => {
    const currentScrollPosition = window.pageYOffset || document.documentElement.scrollTop;
    if (currentScrollPosition > scrollThreshold) {
        // Scrolling down
        if (currentScrollPosition > lastScrollPosition) {
            headerWrapper.style.transform = `translateY(${getTranslateValue()}px)`;
        }
        // Scrolling up
        else {
            headerWrapper.style.transform = 'translateY(0)';
        }
    } else {
        // Reset position when above threshold
        headerWrapper.style.transform = 'translateY(0)';
    }
    lastScrollPosition = currentScrollPosition;
});

// Handle resize events
window.addEventListener('resize', () => {
    if (lastScrollPosition > scrollThreshold) {
        headerWrapper.style.transform = `translateY(${getTranslateValue()}px)`;
    }
});

Acceptable Use Policy

Send us a message

  • This field is for validation purposes and should be left unchanged.
  • If applicable
document.addEventListener('gform/post_render', function (event) { if (!event.detail || Number(event.detail.formId) !== 4) { return; } const form = document.querySelector('#gform_4'); if (!form) { return; } const summary = form.querySelector('.gform_validation_errors'); if (!summary) { return; } /* * Make the validation notice programmatically focusable * and announce it to assistive technology. */ summary.setAttribute('tabindex', '-1'); summary.setAttribute('role', 'alert'); summary.setAttribute('aria-live', 'assertive'); /* * Wait until Gravity Forms and the browser finish their own * validation/render handling, then bring the notification into view. */ setTimeout(function () { summary.focus({ preventScroll: true }); const y = summary.getBoundingClientRect().top + window.pageYOffset - 120; window.scrollTo({ top: y, behavior: 'smooth' }); }, 150); });