cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

Quick-add: + add another resource

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.

Quick-add: + add another resource

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.

            
              .button
  .fa.fa-bars

.menu
  %nav
    %ul
      %li
        %a{:href => 'home_is_visible'} Home
      %li
        %a{:href => 'aboutus_is_visible'} About
      %li
        %a{:href => 'clients_is_visible'} Clients
      %li
        %a{:href => 'contactus_is_visible'} Contact Us
  
.content.home
  %h1 OffCanvas Nav
  - (1..5).each do |i|
    %p Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend %leo
  
  
.content.aboutus
  %h1 About Us
  - (1..5).each do |i|
    %p Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend %leo
      
.content.clients
  %h1 Clients
  - (1..5).each do |i|
    %p Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend %leo
      
.content.contactus
  %h1 Contact Us
  - (1..5).each do |i|
    %p Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend %leo
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Poiret+One);

*{box-sizing: border-box;}

.button {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 10000;
  color: white;
  padding: 10px;
  font-size: 30px;
  cursor: pointer;
  .fa {
    transition: color 1000ms cubic-bezier(.68, -0.55, 0.265, 1.55);
    transition-delay: .75s;
  }
}

html {
  overflow-x: hidden;
}

body {
  color: #fff;
  font-family: 'Poiret One', cursive;
  position: relative;
  background: crimson;
  transform: translateX(0);
  transition: transform 800ms cubic-bezier(0.68, -0.55, 0.265, 1.55);
}



.menu {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 400px;
  padding-left: 0;
  transform: translateX(-150%);
  transition: transform 500ms cubic-bezier(.68, -0.55, 0.265, 1.55);
  transition-delay: .2s;
}



.content {
  position: absolute;
  margin: 0 auto;
  padding: 30px 20%;
  font-size: 18px;
  transform: translateX(100%);
  transition: color 1s ease 1s, background .5s ease 1s, transform 1000ms cubic-bezier(.68, -0.55, 0.265, 1.55) .5s;
}


//general
h1 { font-size: 60px; }
p {
  margin-bottom: 100px;
  line-height: 2.4;
}

//nav
ul {
  margin: 0;
  padding: 20px 0;
  list-style: none;
}
li {
  margin: 0;
  padding: 0;
}
a {
  text-decoration: none;
  display: block;
  padding: 10px 20px;
  padding-left: 120px;
  &:hover {
    background: slategrey;
  }
}

//// silent selectors
//for showing diff pages
%translate-zero {
  transform: translateX(0);
}
// put active page on top
%top-index {
  z-index: 5000;
}

@mixin visible($class, $theme, $bg) {
  .#{$class}_is_visible {
    .#{$class} {
      @extend %translate-zero;
      @extend %top-index;
      color: $theme;
      background: $bg;
    }
    .button .fa {
      color: $theme;
    }
    a {
      color: $theme;
    } 
  }
}

// class name, font color, background color
@include visible(home, white, cadetblue);
@include visible(aboutus, black, salmon);
@include visible(clients, white, darkgoldenrod);
@include visible(contactus, black, sandybrown);

//show nav
body.nav_is_visible {
  transform: translateX(300px);
  .menu {
    transform: translateX(-100%);
  }
}
            
          
!
            
              $('body').addClass('home_is_visible');

$('.button').on("click", function(){
  $('body').toggleClass('nav_is_visible');
});

function removeClasses() {
  $(".menu ul li").each(function() {
    var link = $(this).find('a').attr('href');
  $('body').removeClass(link);
  });
}
$('.menu a').on("click", function(e){
  e.preventDefault();
  removeClasses();
  var link = $(this).attr('href');
  $('body').addClass(link);
  $('body').removeClass('nav_is_visible');
});
            
          
!
999px
Loading ..................

Console