Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ 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

Auto Save

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=Poiret+One:100,300,400,700,900" rel="stylesheet">
<nav id="nav">
  <h1>sojin</h1>
  <ul>
    <li><a href="#section1">menu1</a></li>
    <li><a href="#section2">menu2</a></li>
    <li><a href="#section3">menu3</a></li>
    <li><a href="#section4">menu4</a></li>
    <li><a href="#section5">menu5</a></li>
    <li><a href="#section6">menu6</a></li>
  </ul>
</nav>
<div id="contents">
  <div id="section1">We loved.</div>
  <div id="section2">Make you better</div>
  <div id="section3">All in my dream</div>
  <div id="section4">Be Strict with Myself</div>
  <div id="section5">Can't stop to Dream</div>
  <div id="section6">No pains No gain</div>  
</div>
              
            
!

CSS

              
                #nav {overflow: hidden; position: fixed; left: 0; top: 0; width: 100%; background-color: rgba(255,255,255,0.6);}
#nav h1 {float: left; color: #fff; font-size: 40px; padding: 12px 5px 5px 20px; font-weight: 900; }
#nav ul {float: right; }
#nav ul li {display: inline;}
#nav ul li a  {padding: 20px 10px; text-decoration: none; color:#fff; display: inline-block;}


#contents {text-align: center; font-size: 90px; color:#fff; font-family: 'Poiret One', cursive; font-weight:100;}
#contents > div {height: 100vh; line-height: 100vh;}
#section1 {background-color: #827717;}
#section2 {background-color: #9e9d24;}
#section3 {background-color: #afb42b;}
#section4 {background-color: #c0ca33;}
#section5 {background-color: #cddc39;}
#section6 {background-color: #d4e157;}
              
            
!

JS

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

nav.click(function(){
  var target = $(this);       //6개의 버튼 타겟을 변수 target할당
  var index = target.index(); //6개의 버튼에 인덱스를 할당
  //alert(index);
  var section = contents.eq(index); //6개의 컨텐츠에 인덱스 할당
  var offset = section.offset().top; //6개의 컨텐츠의 offset 값을 할당
  //alert(offset);
  $("html, body").animate({scrollTop:offset},400);
});
              
            
!
999px

Console