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 includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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=Lato:100,100i,300,300i,400,400i,700,700i,900,900i'" rel="stylesheet">

<nav id="nav">
	<div class="trigger">
		<h1>sojin's</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>Love begets love.</h2>
      </div>
    </div>
  </div>
  <div id="section2">
    <div class="container">
      <div class="sec2">
        <h2>Time is gold</h2>
      </div>
    </div>
  </div>
  <div id="section3">
    <div class="container">
      <div class="sec3">
        <h2>Asking costs nothing</h2>
      </div>
    </div>
  </div>
  <div id="section4">
    <div class="container">
      <div class="sec4">
        <h2>Better is to bow than break</h2>
      </div>
    </div>
  </div>
  <div id="section5">
    <div class="container">
      <div class="sec5">
        <h2>Habit is second nature</h2>
      </div>
    </div>
  </div>
  <div id="section6">
    <div class="container">
      <div class="sec6">
        <h2>Pain past is pleasure</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: 'UnifrakturCook', cursive; color: #fff; font-size: 40px;}
#contents > div {height: 100vh; line-height: 100vh;}

/* nav */
#nav {position: fixed; left: 0; top: 0; width: 100%; background-color: rgba(0,0,0,0.5);}
#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: 22px;}
.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: #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){
	.trigger {display: block; }
	#nav ul {display:none;}
	#nav ul li {width: 100%; }
}
              
            
!

JS

              
                
//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.css("display","block");
	}
	
});


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