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 CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              .container.container--orange
  .contents
    h1 Fullscreen Navigation 1
    p  Lorem ipsum dolor sit amet, consectetur adipisicing elit. Eius laborum eligendi velit, quo saepe quidem quaerat commodi consequatur, asperiores tenetur, ex dicta omnis vitae odit totam nemo necessitatibus harum! Eligendi.
  .navTrigger
    i
  nav.nav.nav1
    .nav1__links
      a(href="#").nav1__link 1
      a(href="#").nav1__link 2
      a(href="#").nav1__link 3
      a(href="#").nav1__link 4


.container.container--green
  .contents
    h1 Fullscreen Navigation 2
    p  Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quisquam illo debitis perferendis reiciendis voluptas, temporibus fugiat voluptatibus ullam qui, aperiam explicabo veniam rem tempora! Optio libero voluptatum vero, aspernatur.
  .navTrigger
    i
  nav.nav.nav2
    .nav2__links
      a(href="#").nav2__link 1
      a(href="#").nav2__link 2
      a(href="#").nav2__link 3
      a(href="#").nav2__link 4


.container.container--blue
  .contents
    h1 Fullscreen Navigation 3
    p  Lorem ipsum dolor sit amet, consectetur adipisicing elit. Commodi, doloremque, quibusdam. Quisquam voluptates architecto delectus vitae consectetur, nulla odio quae neque cum, veritatis aperiam maiores dolor officiis.
  .navTrigger
    i
  nav.nav.nav3
    .nav3__links
      a(href="#").nav3__link 1
      a(href="#").nav3__link 2
      a(href="#").nav3__link 3
      a(href="#").nav3__link 4

.container.container--purple
  .contents
    h1 Fullscreen Navigation 4
    p  Lorem ipsum dolor sit amet, consectetur adipisicing elit. Aut magni hic suscipit officia autem quae quis aliquid maiores similique assumenda quam, harum asperiores tenetur adipisci sunt. Error sit saepe tempora.
  .navTrigger
    i
  nav.nav.nav4
    .nav4__links
      a(href="#").nav4__link 1
      a(href="#").nav4__link 2
      a(href="#").nav4__link 3
      a(href="#").nav4__link 4
            
          
!
            
              @import url('https://fonts.googleapis.com/css?family=Open+Sans');
$sans-serif: "Open Sans";

* {
  box-sizing: border-box;
}

body {
  line-height: 1.5;
  background-color: #444;
	font-family: $sans-serif;
}

h1 {
  font-size: 2rem;
  font-weight: bold;
  text-shadow: 0px 1px 1px rgba(0,0,0,0.1);
  margin-bottom: 15px;
  line-height: 1.2;
  color: #eee;
  
  @media(min-width: 400px) {
    font-size: 2.6rem;
  }
}

p {
  color: #ddd;
  margin-bottom: 20px;
}

// trigger ---------------------------
.navTrigger {
  width: 24px;
  height: 24px;
  position: absolute;
  top: 20px;
  right: 20px;
  cursor: pointer;
  z-index: 500;
  
  i {
    transition-property: transform background-color;
    transition-duration: 0.3s;
    transition-delay: 0.3s;
    width: 100%;
    height: 3px;
    position: absolute;
    top: 8px;
    left: 0;
    background-color: #fff;
    
    &:before,
    &:after {
      content:"";
      transition-property: transform background-color;
      transition-duration: 0.3s;
      transition-delay: 0.3s;
      width: 100%;
      height: 3px;
      position: absolute;
      left: 0;
      background-color: #fff;
    }
    
    &:before {
      top: -8px;
    }
    
    &:after {
      top: 8px;
    }
  }
  
  // active -------------------------------
  &.active {
    i {
      background-color: transparent;

      &:before,
      &:after {
        top: 0px;
      }

      &:before {
        transform: rotate(45deg);
      }

      &:after {
        transform: rotate(-45deg);
      }
    }
  }
}


.container {
  position: relative;
  max-width: 480px;
  min-height: 320px;
  border: 20px solid #eee;
  margin: 30px auto;
  padding: 20px;
  box-shadow: 1px 4px 6px rgba(0,0,0,0.6);
  overflow: hidden;
  background-image: linear-gradient(105deg, rgba(0,0,0,0.1) 40%, transparent 40%);
  
  &--orange {
    background-color: #d53;
  }
  
  &--green {
    background-color: #7b5;
  }
  
  &--blue {
    background-color: #348;
  }
  
  &--purple {
    background-color: #a29;
  }
}



// Nav ----------
// ------------------------------------------------

%nav {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  visibility: hidden;
  transition-property: visibility;
}

%nav__links {
  width: 100%;
  height: 100%;
}

%nav__link {
  $bg-color: #333;
  display: block;
  background-color: $bg-color;
  padding: 20px;
  text-decoration: none;
  color: #fff;
  font-weight: bold;
  outline: 1px solid rgba(0,0,0,0.15);
  
  &:hover {
    background-color: lighten($bg-color,7%);
  }
}


//-----------------------------------------


.nav1 {
  @extend %nav;
  $items: 4;
  $duration: 0.4s;
  $delay: 0.2s;
  transition-delay: $duration + $delay * $items;

  &__links {
    @extend %nav__links;
    perspective: 150px;
  }
  
  &__link {
    @extend %nav__link;
    transition:
      transform $duration ease-in-out,
      opacity $duration ease-in-out;
    transform: translateY(0px) translateZ(-150px);
    width: 50%;
    height: 50%;
    float: left;
    opacity: 0;
    
    @for $i from 0 through $items {
      &:nth-child(#{$i + 1}) {
        transition-delay: $i * $delay;
      }  
    }
  }
  
  // active ------------------------------
  &.active {
    transition-delay: 0s;
    visibility: visible;
    
    .nav1__link {
      transform: translateY(0px) translateZ(0px);
      opacity: 1;
    }
  }
}


// ------------------------------------------------
.nav2 {
  @extend %nav;
  $items: 4;
  $duration: 0.35s;
  $delay: 0.2s;
  transition-delay: $duration + $delay * $items;
  
  &__links {
    @extend %nav__links;
  }
  
  &__link {
    @extend %nav__link;
    transition: transform $duration ease-out;
    width: 100% / $items;
    height: 100%;
    float: left;

    @for $i from 0 through $items {  
      &:nth-child(#{$i + 1}) {  
        transition-delay: $i * $delay;
      }
    }
    
    &:nth-child(odd) {
      transform: translateY(-100%);
    }
    
    &:nth-child(even) {
      transform: translateY(100%);
    }
  }
  
  // active -----------------------------
  &.active {
    visibility: visible;
    transition-delay: 0s;
    
    .nav2__link {
      transform: translateY(0%);
    }
  }
}


// ------------------------------------------------
.nav3 {
  @extend %nav;
  $items: 4;
  $duration: 0.45s;
  $delay: 0.15s;
  transition-delay: $duration + $delay * $items;
  
  &__links {
    @extend %nav__links;
    perspective: 100px;
  }
  
  &__link {
    @extend %nav__link;
    transition: transform $duration ease-in;
    transform: translateX(100%) translateZ(50px);
    width: 100%;
    height: 100% / $items;

    @for $i from 0 through $items {  
      &:nth-child(#{$i + 1}) {  
        transition-delay: $i * $delay;
      }  
    }
  }
  
  // active -----------------------------
  &.active {
    visibility: visible;
    transition-delay: 0s;
    
    .nav3__link {
      transform: translateX(0) translateZ(0px);
    }
  }
}


// ------------------------------------------------
.nav4 {
  @extend %nav;
  $items: 4;
  $duration: 0.4s;
  $delay: 0.2s;
  transition-delay: $duration + $delay * $items;
  
   &__links {
     @extend %nav__links;
  }
  
  &__link {
    @extend %nav__link;
    transition: transform $duration ease-out;
    transform: translateX(-200%) rotate(180deg);
    width: 50%;
    height: 50%;
    float: left;

    @for $i from 0 through $items {
      &:nth-child(#{$i + 1}) {
        transition-delay: $i * $delay;
      }  
    }
  }

  // active -----------------------------
  &.active {
    transition-delay: 0s;
    visibility: visible;

    .nav4__link {
      transform: translateX(0) rotate(0deg);
    }
  }
}
            
          
!
            
              $(function(){
  var trigger = $(".navTrigger");
  
  trigger.on("click",function(){
    $(this).toggleClass("active");
    $(this).next().toggleClass("active");
  });
});
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console