Sticky header

                              
<div id="wrap">
      <div id="header">
          <div class="inner">
              <span>header</span>
          </div>
      </div>
      <div class="contents">
          <span>contents</span>
      </div>
</div>
                              
                            
                              
#header{position: fixed; top:0; transition: .2s ease; width: 100%; height: 65px; z-index: 1000; background-color: #333;
  .inner{display: flex; align-items: center; justify-content: center; padding: 15px; box-sizing: border-box;
      span{display: inline-block; line-height: 32px; font-size: 20px; font-family: 'Noto Sans'; color: #fff;}
    }
  &.headUp{top: -65px;}
}
.contents{position: absolute; top: 65px; width: 100%; height: 2000px;
display: flex; align-items: center; justify-content: center; background-color: #555;
    span{font-size: 30px; font-family: 'Noto Sans'; color: #fff;}
}
                              
                          
                              
#wrap #header {
    position: fixed;
    top: 0;
    transition: .2s ease;
    width: 100%;
    height: 65px;
    z-index: 1000;
    background-color: #333;
}

#wrap #header.headUp {
  top: -65px;
}

#wrap #header .inner {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    -webkit-box-pack: center;
        -ms-flex-pack: center;
            justify-content: center;
    padding: 15px;
    -webkit-box-sizing: border-box;
            box-sizing: border-box;
}

#wrap #header .inner span {
    display: inline-block;
    line-height: 32px;
    font-size: 20px;
    font-family: 'Noto Sans';
    color: #fff;
}

#wrap .contents {
    position: absolute;
    top: 65px;
    width: 100%;
    height: 2000px;
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
        -ms-flex-align: center;
            align-items: center;
    -webkit-box-pack: center;
        -ms-flex-pack: center;
            justify-content: center;
    background-color: #555;
}

#wrap .contents span {
    font-size: 30px;
    font-family: 'Noto Sans';
    color: #fff;
}
                              
                            
                      
$(function() {
    var lastScrollTop = 0;
    $(window).scroll(function() {
        var st = $(this).scrollTop();
        if (st > lastScrollTop) {
            $('#header').removeClass('headDown').addClass('headUp');
        } else {
            $('#header').removeClass('headUp').addClass('headDown');
        }
        lastScrollTop = st;
    });
});
                      
                  
Esc 혹은 우측 상단 X 버튼을 눌러 결과창을 닫을 수 있습니다.
contents