/**
 * Checks if header needs to change depending on scrolling
 * remove old functions: headerCheck() and headerChange()
 *
 * @since 2.0.7 Fix Jump on mobile while scrolling
 */
function headerCheck() {
    window.addEventListener('scroll', headerHandleScroll);
    if($(window).width() < 767) {
        window.removeEventListener('scroll', headerHandleScroll);
    }
}

/**
 * Handle big or small header
 * depending on scroll position
 */
function headerHandleScroll() {
    let header = $('header');
    if($(window).scrollTop() >= $(header).outerHeight()) {
        $(header).hide();
    }
    else {
        $(header).show();
    }
}

/**
 * Check again on window resize
 */
$( window ).resize(headerCheck);