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

              
                <div id="site-wrapper">
    <nav class="menu" role="navigation">
      <ul>
        <li><a href="">Home</a></li>
        <li><a href="#about">About</a></li>
        <li><a href="#gallery">Gallery</a></li>
        <li><a href="#contact">Contacts</a></li>
      </ul>
      <p>&#169; 2016 <a href="https://twitter.com/RiccardoZanutta" target="_blank">Riccardo Zanutta</a>, Front-end-Developer</p>
    </nav>
    <a href="#" class="nav-toggle"><span class="fa fa-bars"></span></a>

    <main role="main">
      <section id="about">
        <h1>Cool Off-Canvas Navigation</h1>
        <ul>
        	<li>CSS3 Transitions & Transform;</li>
        	<li>Modernizr Fallback for IE8 </li>
          <li>Keyboard Support (Press Esc)</li>
        	<li>Cool Hover effect :) </li>
        </ul>
      </section><!-- /#about -->
    </main>
  </div><!-- /#site-wrapper -->
              
            
!

CSS

              
                @import "bourbon";

// Main Vars

//Primary colors

$gray           : rgb(146,146,146);
$dirty-white    : rgb(247,247,247);
$dove-gray      : rgb(110,110,110);
$black          : rgb(0, 0, 0);
$white          : rgb(255,255,255);
$tangerine      : #FA3251;
$charlotte      : rgb(198,232,246);
$silver         : rgb(204,204,204);

// Base vars

$body-bg          : linear-gradient(to bottom, rgba(246,46,36,1) 0%, rgba(255,54,121,1) 100%);
$text-color       : rgba(255,255,255, 0.8);
$link-color       : $tangerine;

// Navbar colors.

$nav-bg         : #333;
$nav-links-color: rgba(255, 255, 255, 0.7);

// Helper mixins

// Opacity with fallback for IE8
@mixin opacity($opacity) {
  opacity: $opacity;
  $opacity-ie: $opacity * 100;
  filter: alpha(opacity=$opacity-ie); //IE8
}

// RGBA fallback
@mixin rgba($property, $background: white, $opacity: 0.5, $mix: white) {
  #{$property}: mix($background, $mix, $opacity * 100%);
  #{$property}: rgba($background, $opacity);
}

// General Styles to make Everything ok.

@import url("https://fonts.googleapis.com/css?family=Lato");

* {
  box-sizing: border-box;
}

html {
  background: $body-bg;
  font-size: 16px;
  line-height: 1.5;
  font-family: 'Lato', sans-serif;
  color: $text-color;
  overflow: hidden;
}

body, html {
  width: 100%;
  height: 100%;
}

#site-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  padding-left: 40px;
}

main {
  *zoom: 1;
  width: auto;
  max-width: 1200px;
  float: none;
  display: block;
  margin-right: auto;
  margin-left: auto;
  padding-left: 10px;
  padding-right: 10px;
  margin-top: 20px;
}
main:before, main:after {
  content: '';
  display: table;
}
main:after {
  clear: both;
}

/* Navbar Menu Component */

.menu {
  width: 300px;
  height: 100%;
  background: $nav-bg;
  position: fixed;
  top: 0;
  right: -300px;
  backface-visibility: hidden;
  overflow: hidden;
  transform: translateX(0);
  transform: translateX(0) translateZ(0);
  transform: translate3d(0, 0, 0);
  transition: all 0.3s cubic-bezier(0.32,1.25,0.375,1.15);
  z-index: 10;
  &.show-nav {
    transform: translateX(-300px);
    transform: translateX(-300px) translateZ(0);
    transform: translate3d(-300px, 0, 0);
  }
  ul {
    margin: 0;
    padding: 0;
    li {
      position: relative;
      list-style: none;
      width: 60%;
      margin: 0 auto;
      padding: 20px 10px;
      text-align: center;
      border-top: 1px solid #333;
      box-shadow: 0 -1px 1px -1px #746559;
      &:first-child {
        margin-top: 20px;
        border: 0;
        box-shadow: none;
      }
      a {
        position: relative;
        font-weight: 300;
        padding: 8px 10px;
        color: $nav-links-color;
        color: rgb(255, 255, 255);
        text-decoration: none;
        text-transform: uppercase;
        transition: all 0.25s ease-in-out;
        &:after {
          content: "";
          position: absolute;
          bottom: 0;
          left: 0;
          width: 100%;
          height: 1px;
          background-color: $tangerine;
          visibility: hidden;
          transform: scaleX(0);
          transition: all 0.3s cubic-bezier(0.32,1.25,0.375,1.15);
        }
        .no-touch &:hover {
          //color: $tangerine;
          &:after {
            transform: scale(1);
            visibility: visible;
          }
        }
      }
    }
  }

  p {
    color: $nav-links-color;
    position: absolute;
    top: 86%;
    left: 20px;
    font-size: em(14px);
    text-align: center;
    a {
      color: $tangerine;
      text-decoration: none;
      transition: all 0.3s ease;
      &:hover {
        color: $tangerine;
        text-decoration: underline;
      }
    }
  }
}

.nav-toggle {
  position: fixed;
  top: 30px;
  right: 30px;
  backface-visibility: hidden;
  transform: translateX(0);
  transform: translateX(0) translateZ(0);
  transform: translate3d(0, 0, 0);
  transition: all 0.4s cubic-bezier(0.32,1.25,0.375,1.15);
  z-index: 11;
  span {
    color: rgba(255, 255, 255, 0.8);
    padding: 5px;
    font-size: em(30px);
    .no-touch &:hover {
      color: white;
    }
    &.fa-times {
      color: #fff;
      &:hover {
        color: #fff;
      }
    }
  }
  &.show-nav {
    top: 12px;
    right: 12px;
  }
}
              
            
!

JS

              
                // Vars

var wrapper    = $("#site-wrapper"),
    menu       = $(".menu"),
    menuLinks  = $(".menu ul li a"),
    toggle     = $(".nav-toggle"),
    toggleIcon = $(".nav-toggle span");

function toggleThatNav() {
  if (menu.hasClass("show-nav")) {
    if (!Modernizr.csstransforms) {
      menu.removeClass("show-nav");
      toggle.removeClass("show-nav");
      menu.animate({
        right: "-=300"
      }, 500);
      toggle.animate({
        right: "-=300"
      }, 500);
    } else {
      menu.removeClass("show-nav");
      toggle.removeClass("show-nav");
    }
    
  } else {
    if (!Modernizr.csstransforms) {
      menu.addClass("show-nav");
      toggle.addClass("show-nav");
      menu.css("right", "0px");
      toggle.css("right", "330px");
    } else {
      menu.addClass("show-nav");
      toggle.addClass("show-nav");
    } 
  }
}

function changeToggleClass() {
  toggleIcon.toggleClass("fa-times");
  toggleIcon.toggleClass("fa-bars");
}

$(function() {
  toggle.on("click", function(e) {
    e.stopPropagation();
    e.preventDefault();
    toggleThatNav();
    changeToggleClass();
  });
    // Keyboard Esc event support
  $(document).keyup(function(e) {
    if (e.keyCode == 27) {
      if (menu.hasClass("show-nav")) {
        if (!Modernizr.csstransforms) {
          menu.removeClass("show-nav");
          toggle.removeClass("show-nav");
          menu.css("right", "-300px");
          toggle.css("right", "30px");
          changeToggleClass();
        } else {
          menu.removeClass("show-nav");
          toggle.removeClass("show-nav");
          changeToggleClass();
        }
      }
    } 
  });
});

alsolike(
  "NNzGVd", "Search input context animation",
  "aOQddB", "Open & Close Animation",
  "wBOder", "Subtle Icons hover effect"
);

 /* Thanks to:
  @fbrz for the "You might also like" plugin
*/
              
            
!
999px

Console