Membuat Header Mengecil Ketika Di Scroll

CSS DIATAS </head>   <style type='text/css'> header1 { width: 100%; height: 150px; overflow: hidden; ...



CSS DIATAS </head>
 
<style type='text/css'>
  header1 {
   width: 100%;
   height: 150px;
   overflow: hidden;
   position: fixed;
   top: 0;
   left: 0;
   z-index: 999;
   background-color: #0683c9;
   -webkit-transition: height 0.3s;
      -moz-transition: height 0.3s;
      -ms-transition: height 0.3s;
      -o-transition: height 0.3s;
      transition: height 0.3s;
  }
  
  header1 h1#logo {
   font-family: "Oswald", sans-serif;
   font-size: 60px;
   font-weight: 400;
   line-height: 150px;
   display: inline-block;
   float: left;
   height: 150px;
    margin: 0;
    padding: 0;
   color: #fff;
   -webkit-transition: all 0.3s;
   -moz-transition: all 0.3s;
   -ms-transition: all 0.3s;
   -o-transition: all 0.3s;
   transition: all 0.3s;
  }
  
  header1 nav1 {
    display: inline-block;
    float: right;
  }
  
  header1 nav1 a {
  line-height: 150px;
  margin-left: 20px;
  color: #9fdbfc;
  font-weight: 700;
  font-size: 18px;
  text-decoration: none;
  -webkit-transition: all 0.3s;
  -moz-transition: all 0.3s;
  -ms-transition: all 0.3s;
  -o-transition: all 0.3s;
  transition: all 0.3s;
  }
  
  /* smaller nav1 */
  
  header1 nav1 a:hover {
    color: #ffffff;
  }
  
  header1.smaller {
      height: 75px;
  }
  header1.smaller h1#logo {
      width: 150px;
      height: 75px;
      line-height: 75px;
      font-size: 30px;
  }
  header1.smaller nav1 a {
      line-height: 75px;
  }
  
  
  @media all and (max-width: 660px) {
      header1 h1#logo {
          display: block;
          float: none;
          margin: 0 auto;
          height: 100px;
          line-height: 100px;
          text-align: center;
      }
      header1 nav1 {
          display: block;
          float: none;
          height: 50px;
          text-align: center;
          margin: 0 auto;
      }
      header1 nav1 a {
          line-height: 50px;
          margin: 0 10px;
      }
      header1.smaller {
          height: 75px;
      }
      header1.smaller h1#logo {
          height: 40px;
          line-height: 40px;
          font-size: 30px;
      }
      header1.smaller nav1 {
          height: 35px;
      }
      header1.smaller nav1 a {
          line-height: 35px;
      }
  }
</style>
 
 
JAVASCRIP
 
<script type='text/javascript'>
    function init() {
        window.addEventListener('scroll', function(e){
          var distanceY = window.pageYOffset || document.documentElement.scrollTop,
            shrinkOn = 200,
            header1 = document.querySelector("header1");
          if ((distanceY) > (shrinkOn)) {
            $(header1).addClass("smaller");
          } else { 
            if ($(header1).hasClass("smaller")) {
              $(header1).removeClass("smaller");
            }
          }
      });
    }
    init();
  </script> 
 

HTML
<header1 class='site-header1'>
      <div class='container clearfix'>
        <h1 id='logo'>
                LOGO
            </h1>
        <nav1>
          <a href=''>Lorem</a>
          <a href=''>Ipsum</a>
          <a href=''>Dolor</a>
        </nav1>
      </div>
    </header1>
 
 
SUMBER : https://mastamvan.blogspot.co.id/2016/09/membuat-header-mengecil-ketika-di-scroll.html 

COMMENTS

Nama

artis BLOGGER CSS otomotif sport
false
ltr
item
Aneka Resposive: Membuat Header Mengecil Ketika Di Scroll
Membuat Header Mengecil Ketika Di Scroll
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvoCcFimnle73ntIateW_mIk71wuG57r355wCMvQwb9_YUacV_oxUCXKmKRKtGFpvWh6dakLaAc_6Xm1KcFL_dHvRCXUy_IG9IVv9fW8ol3L8xVLE_6cdoftwymgr0mOQ5rDzIbszC1eJ5/s320/Header-Resize-On-Scroll.jpg
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvoCcFimnle73ntIateW_mIk71wuG57r355wCMvQwb9_YUacV_oxUCXKmKRKtGFpvWh6dakLaAc_6Xm1KcFL_dHvRCXUy_IG9IVv9fW8ol3L8xVLE_6cdoftwymgr0mOQ5rDzIbszC1eJ5/s72-c/Header-Resize-On-Scroll.jpg
Aneka Resposive
https://anekarespon.blogspot.com/2016/11/membuat-header-mengecil-ketika-di-scroll.html
https://anekarespon.blogspot.com/
http://anekarespon.blogspot.com/
http://anekarespon.blogspot.com/2016/11/membuat-header-mengecil-ketika-di-scroll.html
true
6641014136173328522
UTF-8
Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS CONTENT IS PREMIUM Please share to unlock Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy