cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmloctocatspinnerstartv

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.

            
              <header class="header">
		<div class="wrap">
			<h1 class="header_logo">tweenmaxDemo</h1>
			<div class="header_navButton" data-nav="close">
				<i class="lineCenter"></i>
			</div>
		</div>
	</header>
	<nav class="nav">
		<ul class="nav_list">
			<li><a href="">content1</a></li>
			<li><a href="">content2</a></li>
			<li><a href="">content3</a></li>
		</ul>
		<a href="" class="nav_close"></a>
	</nav>	

	<script type="text/javascript" src="http://satohmsys.info/files/demo/tweenmax/site/js/tweenmax/minified/TweenMax.min.js"></script>
            
          
!
            
              @import url(https://fonts.googleapis.com/css?family=Pacifico);
body, html {
  padding: 0;
  margin: 0;
}

html {
  height: 100vh;
  position: relative;
  border-top: solid 5px #121212;
  line-height: 1.6;
}

img {
  line-height: 1;
  max-width: 100%;
  height: auto;
  outline: 0;
}

ul {
  margin: 0;
  padding: 0;
}

.header_logo, .mainVisual {
  font-family: 'Pacifico', cursive;
}

.wrap {
  max-width: 1100px;
  padding-left: 50px;
  padding-right: 50px;
  margin-left: auto;
  margin-right: auto;
}

@media screen and (max-width: 600px) {
  .wrap {
    padding-left: 1em;
    padding-right: 1em;
  }
}

.content {
  padding-top: 3em;
}

.header {
  background: #f9f9f9;
}
.header .wrap {
  height: 80px;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-align-items: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-align-content: center;
      -ms-flex-line-pack: center;
          align-content: center;
  -webkit-justify-content: space-between;
      -ms-flex-pack: justify;
          justify-content: space-between;
  -webkit-flex-wrap: wrap;
      -ms-flex-wrap: wrap;
          flex-wrap: wrap;
}
.header_logo {
  margin: 0;
}
.header_navButton {
  height: 50px;
  width: 50px;
  padding: 15px;
  box-sizing: border-box;
  position: relative;
  cursor: pointer;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-align-content: stretch;
      -ms-flex-line-pack: stretch;
          align-content: stretch;
  border-radius: 2px;
  background-color: #888;
}
.header_navButton:before, .header_navButton:after,
.header_navButton .lineCenter {
  content: " ";
  width: 60%;
  height: 3px;
  margin: auto;
  position: absolute;
  right: 0;
  left: 0;
  display: block;
  border-radius: 1px;
  background-color: #fff;
}
.header_navButton:before {
  top: 15px;
  left: 0;
}
.header_navButton:after {
  bottom: 15px;
  left: 0;
}
.header_navButton .lineCenter {
  top: 0;
  bottom: 0;
}
@media screen and (max-width: 600px) {
  .header {
    width: 100%;
    margin: auto;
    display: block;
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 5;
    border-top: solid 5px #121212;
  }
  .header_logo {
    margin-left: 1em;
    font-size: 5vw;
  }
  .header .wrap {
    height: 50px;
    padding-left: 0;
    padding-right: 0;
  }
  .header_navButton {
    right: 0;
    position: absolute;
  }
}

.nav {
  width: 100vw;
  height: 100vh;
  margin: 0;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 99;
  background-color: rgba(0, 0, 0, 0.9);
}
.nav, .nav_list, .nav_list li {
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-align-items: center;
      -ms-flex-align: center;
          align-items: center;
  -webkit-justify-content: center;
      -ms-flex-pack: center;
          justify-content: center;
}
.nav {
  display: none;
}
.nav_list {
  width: 100vw;
  height: 30vw;
  -webkit-flex-direction: column;
      -ms-flex-direction: column;
          flex-direction: column;
}
.nav_list li {
  width: 100%;
  height: 33.3%;
  border-bottom: solid 1px rgba(255, 255, 255, 0.3);
  text-align: center;
  list-style: none;
}
.nav_list li:first-child {
  border-top: solid 1px rgba(255, 255, 255, 0.3);
}
.nav_list li a {
  font-size: 2.5vw;
  text-decoration: none;
  color: #fff;
}
.nav_list li a:hover {
  letter-spacing: 0.01em;
}
.nav_close {
  width: 40px;
  height: 40px;
  display: block;
  position: absolute;  
  right: 0;
  bottom: 10px;
}
.nav_close:before, .nav_close:after {
  margin: auto;
  display: block;
  position: absolute;
  right: 0;
  left: 0;
}
.nav_close:before, .nav_close:after {
  content: " ";
  width: 25px;
  height: 1px;
  -webkit-transform-origin: 50% 50%;
      -ms-transform-origin: 50% 50%;
          transform-origin: 50% 50%;
  background-color: #fff;
  transition: all 0.4s;
}
.nav_close:before {
  -webkit-transform: rotate(45deg);
      -ms-transform: rotate(45deg);
          transform: rotate(45deg);
}
.nav_close:after {
  -webkit-transform: rotate(-45deg);
      -ms-transform: rotate(-45deg);
          transform: rotate(-45deg);
}
.nav_close:hover:before {
  -webkit-transform: rotate(-45deg);
      -ms-transform: rotate(-45deg);
          transform: rotate(-45deg);
}
.nav_close:hover:after {
  -webkit-transform: rotate(45deg);
      -ms-transform: rotate(45deg);
          transform: rotate(45deg);
}
@media screen and (max-width: 600px) {
  .nav_list {
    height: 50vw;
  }
}

            
          
!
            
              var getByClass = function( cls, num ){
	if( typeof num == "number" ){
		classCollection = document.getElementsByClassName( cls )[num];
	} else {
		classCollection = document.getElementsByClassName( cls );
		classCollection.length == 1 ? classCollection = classCollection[0] : '';

	}
	return classCollection;
};


$button = getByClass( 'header_navButton' ),
$nav = getByClass( 'nav' ),
$nav_close = getByClass( 'nav_close' ),
  $TimelineMax = new TimelineMax();

/**
* ナビ表示
*/
function Nav(){};
Nav.prototype.do = function(){
	this.status = $button.getAttribute( 'data-nav' );
	this.status == 'close' ? this.open() : this.close();
}
Nav.prototype.open = function(){
	$TimelineMax.fromTo( $nav, 0.5, {
		perspective: 200,
		scale: 0.95,
		transformOrigin: 'center center',
		rotationX: 75,
		opacity: 0,
		display: 'flex'
	},{
		scale: 1,
		rotationX: 0,
		opacity: 1,
		// lazy: true,
		onComplete: function(){
			document.body.style.overflow = 'hidden';
		}
	})
	$button.setAttribute( 'data-nav', 'open' );	
}
Nav.prototype.close = function(){
	$TimelineMax.to( $nav, 0.5, {
		scale: 0.95,
		rotationX: -75,
		z: 300,
		opacity: 0,
		display: 'none',
		onComplete: function(){
			document.body.style.overflow = 'visible';				
		}
	})
	$button.setAttribute( 'data-nav', 'close' );		
}
var Navigation = new Nav();

$nav.addEventListener( 'click', function( e ){
	e.stopPropagation();
	Navigation.do();
});
$button.addEventListener( 'click', function( e ){
	e.stopPropagation();
	Navigation.do();
});
$nav_close.addEventListener( 'click', function( e ){
	e.preventDefault()
	e.stopPropagation();
	Navigation.do();
});

            
          
!
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