css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

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.

            
              nav#corner_toggle.top-left
  #corner_toggle_container
    .gravatar
      img(class="img-circle", src="http://www.gravatar.com/avatar/842947c3ee8edd38db2df1c7d2eaddf6.png", alt="James Gray")
    .links
      a(href="mailto:hello@jamesgrayillustration.com")
        i.ion-email
      a(href="https://codepen.io/jamesgray" target="_blank") Codepen
      a(href="https://github.com/jamesgrayillustration" target="_blank") GitHub
      a(href="http://behance.net/JamesGray2" target="_blank") Behance
    a.corner_toggle_ctrl.top
      i.ion-drag
section
  h1 CORNER MENU
  h2 A different approach to navigation ux
  .btn-group
    button(id="top_left_btn", type="button").btn.btn-default
      i.ion-arrow-up-c
    button(id="top_right_btn", type="button").btn.btn-default
      i.ion-arrow-up-c
  br
  br
  p Lorem ipsum dolor sit amet, consectetur adipisicing elit. Expedita sint quasi esse quas dolor asperiores error possimus, voluptas minima fugiat quod totam, reiciendis animi impedit illum odit. Optio, rem, distinctio. Soluta illo sed qui harum! Repellendus, expedita aliquid minima accusantium, similique maiores magnam laudantium natus quam quos ullam iusto incidunt eos blanditiis tenetur, facilis laboriosam nemo dolor doloremque, mollitia eum. Id nam aperiam repellendus vero, odio magnam nulla nihil aliquam dolorum, saepe laborum sunt, aut, architecto dignissimos. Eligendi saepe, eius beatae, enim voluptatem sunt nihil impedit nam placeat natus ipsum? Repellendus ipsa hic, dicta aliquid fugit, praesentium aliquam vel. Ipsam similique culpa animi ratione, magni, labore, velit officia vero possimus dolorem quo neque inventore natus dolores, magnam ex quibusdam ab. Ex, minus. Rem possimus fugit, qui, tempora veniam voluptatem reiciendis blanditiis laudantium? Fugit sapiente aut, sed ut nobis illo rem nemo quo possimus sit, debitis, soluta dicta in non harum.
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Roboto+Condensed:300italic,400italic,700italic,400,300,700);

@bg_color: #CD5334;
@main_txt_color: #FAD8D6;
@h1_txt_color: #2E282A;
@h2_txt_color: #EDB88B;
@corner_menu_bg_color: @h1_txt_color;
@corner_menu_btn_color: @bg_color;
@shadow25: rgba(0,0,0,0.25);

.transition (@transition) {
	-webkit-transition: @transition;
	-moz-transition:    @transition;
	-ms-transition:     @transition;
	-o-transition:      @transition;
}

.centered {
  margin: 0 auto;
  text-align: center;
}

html, body {
  font-family: "Roboto Condensed", Helvetica, sans-serif;
  font-weight: 100;
  text-transform: uppercase;
  color: @main_txt_color;
}

body {
  background-color: @bg_color;
}

nav#corner_toggle {
  .transition(all .15s ease-in-out);
  z-index: 1000;
  position: fixed;
  background-color: @corner_menu_bg_color;
  height: 500px;
  width: 2000px;
  top: -375px;
  &.top-left {
    left: -1125px;
    transform: rotate(-45deg);
  }
  &.top-right {
    right: -1125px;
    transform: rotate(45deg);
  }
}

#corner_toggle_container {
  width: 100%;
  height: 100%;
}

#corner_toggle_container .gravatar {
  .centered;
  position: fixed;
  bottom: 35%;
  width: 100%;
  & img {
    .centered;
    border: 1px solid @main_txt_color;
    max-height: 100px;
  }
}

#corner_toggle_container .links {
  .centered;
  position: fixed;
  width: 100%;
  bottom: 20%;
  & a {
    padding: 0 10px;
    font-size: 1.5em;
    color: @main_txt_color;
    &:hover {
      color: @bg_color;
      text-decoration: none;
    }
  }
}

.corner_toggle_ctrl {
  .centered;
  position: fixed;
  width: 100%;
  color: @corner_menu_btn_color;
  font-size: 30px;
  &:hover {
    color: @corner_menu_btn_color;
  }
  &.top{
    bottom: 0;
    padding-bottom: 10px;
  }
  & i {
    cursor: pointer;
  }
}

section {
  .centered;
  text-align: left;
  width: 75%;
  padding-top: 40px;
  & h1 {
    color: @h1_txt_color;
    font-size: 2.25em;
    font-weight: 100;
    margin: 10px auto;
  }
  & h2 {
    margin: 10px auto 15px auto;
    font-size: 1.5em;
    color: @h2_txt_color;
  }
  & .btn-group button {
    z-index: 0;
    margin: 5px;
    border-radius: 0;
    border: 0;
    outline: none;
    background-color: @h2_txt_color;
    &:focus {
      outline: 0 !important;
    }
    & i {
      color: @bg_color;
    }
    &:nth-child(1) i {
      display: block;
      transform: rotate(-45deg);
    }
    &:nth-child(2) i {
      display: block;
      transform: rotate(45deg);
    }
    &:nth-child(3) i {
      display: block;
      transform: rotate(-45deg);
    }
    &:nth-child(4) i {
      display: block;
      transform: rotate(45deg);
    }
  }
  & p {
    font-size: 1.15em;
  }
}
            
          
!
            
              $(document).ready(function() {
  
  var corner_toggle 					= $("#corner_toggle"),
  		corner_toggle_container = $("#corner_toggle #corner_toggle_container"),
 			corner_class 						= corner_toggle.attr('class'),
      vert_pos								= "top",
      horiz_pos,
      init_vert 							= "-375",
  		init_horiz 							= "-1125",
      increased_vert 					= parseInt(init_vert)*.5,
      increased_horiz 				= parseInt(init_horiz)*.83;
  
  switch(corner_class){
    case "top-left":
    	horiz_pos = "left";
      break;
    case "top-right":
    	horiz_pos = "right";
      break;
  }
  
  $("button#top_left_btn").click(function(){
    if(corner_toggle.hasClass("top-left")){
      return false;
    } else {
      corner_toggle.fadeOut('fast', function () {
        $(this).delay(250).fadeIn('fast');
        corner_toggle.css("top","");
        corner_toggle.css("right","");
        corner_toggle.removeClass("top-right");
        corner_toggle.addClass("top-left");
        horiz_pos 			= "left";
      });
    }
  });
  
  $("button#top_right_btn").click(function(){
    if(corner_toggle.hasClass("top-right")){
      return false;
    } else {
      corner_toggle.fadeOut('fast', function () {
        $(this).delay(250).fadeIn('fast');
        corner_toggle.css("top","");
        corner_toggle.css("left","");
        corner_toggle.removeClass("top-left");
        corner_toggle.addClass("top-right");
        horiz_pos 			= "right";
      });
    }
  });
  
  corner_toggle_container.click(function() {
    if(corner_toggle.hasClass("active")){
      toggleCornerMenu("in");
    } else {
      toggleCornerMenu("out");
    }
  });

  corner_toggle.swipe({
    tap: function(event, target) {
      if($(this).hasClass("active")){
        toggleCornerMenu("in");
      } else {
        toggleCornerMenu("out");
      }
    },
    swipe:function(event, direction, distance, duration, fingerCount) {
      switch(corner_class){
        case "top-left":
          if(direction == "down" || direction == "right" && !$(this).hasClass("active")){
            toggleCornerMenu("out");
          }
          if(direction == "up" || direction == "left" && $(this).hasClass("active")){
            toggleCornerMenu("in");
          }
          break;
        case "top-right":
          if(direction == "down" || direction == "left" && !$(this).hasClass("active")){
            toggleCornerMenu("out");
          }
          if(direction == "up" || direction == "right" && $(this).hasClass("active")){
            toggleCornerMenu("in");
          }
          break;
      }
    },
    threshold:0
  });
  
  var toggleCornerMenu = function(action) {
    switch(action) {
      case "in":
        corner_toggle.css(vert_pos,init_vert+"px");
        corner_toggle.css(horiz_pos,init_horiz+"px");
        corner_toggle.toggleClass("active");
        break
      case "out":
      	corner_toggle.css(vert_pos,increased_vert+"px");
        corner_toggle.css(horiz_pos,increased_horiz+"px");
        corner_toggle.toggleClass("active");
      	break;
    }
  }
});
            
          
!
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.
Loading ..................

Console