HEX
Server: LiteSpeed
System: Linux server342.web-hosting.com 4.18.0-553.124.4.lve.el8.x86_64 #1 SMP Fri May 15 13:02:13 UTC 2026 x86_64
User: ksonpoau (1099)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: /home/ksonpoau/httpdocs/wp-content/themes/storecommerce/assets/fixed-header-script.js
jQuery(document).ready(function($){

    // Here You can type your custom JavaScript...

    window.onscroll = function() {myFunction()};
    var prevScrollPos = window.pageYOffset;
    var aboveHeader = document.getElementById("above-banner-section-wrapper");
    var aboveHeaderHeight = 0;
        if (typeof(element) != 'undefined' && element != null)
            {
              aboveHeaderHeight = aboveHeader.offsetHeight;
            }

    var header = document.getElementById("site-primary-navigation");
    var sticky = header.offsetTop + aboveHeaderHeight + 75;
    //console.log(sticky);

    function myFunction() {

        var currentScrollPos = window.pageYOffset;
         //console.log(currentScrollPos);
        // console.log(prevScrollPos);
        if ( prevScrollPos > currentScrollPos ) {
        if (sticky > currentScrollPos) {
            //console.log('here we go');
            header.classList.remove("aft-sticky-navigation");
        } else {
            header.classList.add("aft-sticky-navigation");
        }
        }else{
            header.classList.remove("aft-sticky-navigation");
        }
        prevScrollPos = currentScrollPos;
    }



});