Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              <link href="https://fonts.googleapis.com/css?family=Saira:100, 300,700" rel="stylesheet">

<nav id="nav">
  <h1>Still, breathing</h1>
  <ul>
    <li><a href="#section1">★</a></li>
    <li><a href="#section2">☆</a></li>
    <li><a href="#section3">★</a></li>
    <li><a href="#section4">☆</a></li>
    <li><a href="#section5">★</a></li>
    <li><a href="#section6">☆</a></li>
  </ul>
</nav>

<div id="contents">
  <div id="section1">I'm like a child looking off in the horizon</div>
  <div id="section2">I'm like an ambulance that's turning on the sirens</div>
  <div id="section3">Oh, I'm still alive</div>
  <div id="section4">I'm like a soldier coming home for the first time</div>
  <div id="section5">I dodged a bullet and I walked across a landmine</div>
  <div id="section6">Oh, I'm still alive
</div>
</div>
            
          
!
            
              #nav {overflow: hidden; position: fixed; left: 0;top: 0; width: 100%; background-color:rgba(255, 255, 255, 0.5)}
#nav h1 { color:white; font-size: 40px; padding: 14px 5px 16px 20px; float: left;}
#nav ul {float: right;}
#nav ul li {display:inline;}
#nav ul li a {padding: 30px; text-decoration:none; color:white; display:inline-block;}

#contents {text-align:center; font-size: 40px; color:white; font-family: 'Saira', sans-serif; font-weight:100;}
#contents>div {height:100vh; line-height:100vh;}
#section1{background-color: #D7AEB2;}
#section2{background-color: #DF6071;}
#section3{background-color: #CC4337;}
#section4{background-color: #7E6146;}
#section5{background-color: #E78979;}
#section6{background-color: #8B6C71;}

            
          
!
            
              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); //section에 contents의 인덱스를 할당
    var offset=section.offset().top; //6개의 컨텐츠의 offset 값을 할당
  // alert(offset);
   $("html, body").animate({scrollTop:offset},400);
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.

Console