function myFunction() {
            var currentScrollPos = window.pageYOffset;
            if (window.pageYOffset > sticky) {
                header.classList.add("sticky");
            } else {
                header.classList.remove("sticky");
            }
            if (prevScrollpos > currentScrollPos) {
                document.getElementById("headerID").style.top = "0";
            } else {
                document.getElementById("headerID").style.top = "-50px";
            }
            prevScrollpos = currentScrollPos;
        }
// While scrolling down, hide header, when scroll up, show header.
While scrolling down, hide header, when scroll up, show header.
While scrolling down hide header when scroll up show header .
function myFunction() {
            var currentScrollPos = window.pageYOffset;
            if (window.pageYOffset > sticky) {
                header.classList.add("sticky");
            } else {
                header.classList.remove("sticky");
            }
            if (prevScrollpos > currentScrollPos) {
                document.getElementById("headerID").style.top = "0";
            } else {
                document.getElementById("headerID").style.top = "-50px";
            }
            prevScrollpos = currentScrollPos;
        }
function myFunction ( ) { var currentScrollPos = window . pageYOffset ; if ( window . pageYOffset > sticky ) { header . classList . add ( "sticky" ) ; } else { header . classList . remove ( "sticky" ) ; } if ( prevScrollpos > currentScrollPos ) { document . getElementById ( "headerID" ) . style . top = "0" ; } else { document . getElementById ( "headerID" ) . style . top = "-50px" ; } prevScrollpos = currentScrollPos ; }
While scrolling down, hide header, when scroll up, show header.
While scrolling down hide header when scroll up show header .