Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <link href="https://fonts.googleapis.com/css?family=Dosis:300,400,500,600,700" rel="stylesheet">
<nav id="nav">
  <div class="trigger">
    <h1>KEY</h1>
    <div class="bar_wrap">
      <a href="#">
        <span class="bar bar1"></span>
        <span class="bar bar2"></span>
        <span class="bar bar3"></span>
      </a>
    </div>
  </div>
  <ul class="clearfix">
    <li class="on"><a href="#section1">Intro</a></li>  
    <li><a href="#section2">Skill</a></li> 
    <li><a href="#section3">Coding</a></li> 
    <li><a href="#section4">Design</a></li> 
    <li><a href="#section5">About</a></li> 
    <li><a href="#section6">Contact</a></li> 
  <ul>
</nav>



<div id="contents">
  <div id="section1">
    <div class="container">
      <div class="sec1">
        <h2>Come with me in the twilight of a summer night for awhile</h2>
      </div>
    </div>
  </div>
  <div id="section2">
    <div class="container">
      <div class="sec2">
        <h2>Tell me of a story never ever told in the past</h2>
      </div>
    </div>
  </div>
  <div id="section3">
    <div class="container">
      <div class="sec3">
        <h2>Take me back to the land</h2>
      </div>
    </div>
  </div>
  <div id="section4">
    <div class="container">
      <div class="sec4">
        <h2>Where my yearnings were born</h2>
      </div>
    </div>
  </div>
  <div id="section5">
    <div class="container">
      <div class="sec5">
        <h2>The key to open the door is in your hand</h2>
      </div>
    </div>
  </div>
  <div id="section6">
    <div class="container">
      <div class="sec6">
        <h2>Now fly me there</h2>
      </div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                * {padding: 0; margin: 0}
li {list-style: none;}
a {text-decoration: none;}
.clearfix{*zoom:1;}
.clearfix:bofore, clearfix:after {display:block; content:''; line-height:0;}
.clearfix:after {clear:both;}


/* contents */
#contents {text-align: center; font-family: 'Dosis', sans-serif; color: #fff; font-size: 40px;}
#contents > div {height: 100vh; line-height: 100vh;}

/* nav */
#nav {position: absolute; left: 0; bottom: -55px; width: 100%; background-color: rgba(0,0,0,0.5);}
#nav.on {position: fixed;top:0; height:56px; }

#nav ul { }
#nav ul li {float: left; width: 16.66666%;  font-size: 16px; text-align: center;}
#nav ul li a {color: #fff; padding: 20px; display: block; }
#nav ul li.on a {background-color: rgba(0,0,0,0.3);}

/* section */
#section1 {background-image: linear-gradient(to top, #a18cd1 0%, #fbc2eb 100%);}
#section2 {background-image: linear-gradient(45deg, #243949 0%, #517fa4 100%);}
#section3 {background-image: linear-gradient(45deg, #1e3c72 0%, #1e3c72 1%, #2a5298 100%);}
#section4 {background-image: linear-gradient(45deg, #874da2 0%, #c43a30 100%);}
#section5 {background-image: linear-gradient(-20deg, #2b5876 0%, #4e4376 100%);}
#section6 {background-image: linear-gradient(60deg, #29323c 0%, #485563 100%);}

/* trigger */
.trigger {display: none; }
.trigger h1 {padding: 12px 10px 10px 10px; color:#fff; letter-spacing: -1px; font-size: 25px; }
.bar_wrap {position: absolute; right: 5px; top: 5px; }
.bar_wrap a {display: block; width: 40px; height: 40px;}
.bar_wrap a .bar{position: absolute; left: 5px; width: 31px; height: 3px; background-color: #fff; }
.bar_wrap a .bar.bar1 {top: 10px; }
.bar_wrap a .bar.bar2 {top: 18px; }
.bar_wrap a .bar.bar3 {top: 26px; }

/* mediaquery */
@media(max-width:700px){
  #nav ul li {width: 33.3333%;}
}

@media(max-width:480px){
	#nav ul {display:none;}
	#nav ul li {width: 100%;}
 .trigger {display: block;  }
}
              
            
!

JS

              
                $("#nav").each(function(){
  var header = $(this);
  var headerOffset = header.offset().top;
  
  $(window).scroll(function(){
    var wScroll =$(window).scrollTop();
    if(wScroll> headerOffset){
      header.addClass("on");
    } else {
      header.removeClass("on");
    }
  })
  
});


//bar-wrap을 클릭했을 때 네비가 열림

$(".bar_wrap").on('click', function(){
  $("#nav ul").slideToggle();
});


//원상태 복귀시 네비가 사라지는 버그수정
var menu= $("#nav ul");
$(window).resize(function(){
  var wWidth=$(window).width();
  if(wWidth>400 && menu.is(":hidden")){
    menu.removeAttr("style");
  }
});




var nav = $("#nav > ul > li");
var contents = $("#contents > div");
var menu = $("#nav ul");



nav.on('click',function(e){
    e.preventDefault();         //브라우저에 # 기본 기능 차단
    
    var target = $(this);
    var index = target.index();
    //alert(index);
    var section = contents.eq(index);
    var offset = section.offset().top;
    //alert(offset);
    
    $("html, body").animate({scrollTop:offset},300,"easeInQuint");
});

            $(window).scroll(function(){
        var wScroll = $(this).scrollTop();
        
        if(wScroll >= contents.eq(0).offset().top){
            nav.removeClass('on');
            nav.eq(0).addClass('on');
        }
        if(wScroll >= contents.eq(1).offset().top){
            nav.removeClass('on');
            nav.eq(1).addClass('on');
        }
        if(wScroll >= contents.eq(2).offset().top){
            nav.removeClass('on');
            nav.eq(2).addClass('on');
        }
        if(wScroll >= contents.eq(3).offset().top){
            nav.removeClass('on');
            nav.eq(3).addClass('on');
        }
        if(wScroll >= contents.eq(4).offset().top){
            nav.removeClass('on');
            nav.eq(4).addClass('on');
        }
        if(wScroll >= contents.eq(5).offset().top){
            nav.removeClass('on');
            nav.eq(5).addClass('on');
        }
    });

              
            
!
999px

Console