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

              
                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.
              
            
!

CSS

              
                @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;
  }
}
              
            
!

JS

              
                $(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

Console