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.

            
                      <div id="header" class="l-header">
            <div class="wrap">
                <header class="logo">
                    <h1 class="logo__title">
                        <a href="#" class="logo__link">
                           Swing Menu
                        </a>
                    </h1>
                </header>
                <button class="btn menu-btn">Menu</button>
                <nav class="menu">
                    <ul class="menu__list">
                        <li class="menu__item">
                            <a href="#" class="menu__link">Lien A</a>
                        </li><li class="menu__item">
                            <a href="#" class="menu__link">Lien B</a>
                        </li><li class="menu__item">
                            <a href="#" class="menu__link">Lien C</a>
                        </li><li class="menu__item">
                            <a href="#" class="menu__link">Lien D</a>
                        </li><li class="menu__item">
                            <a href="#" class="menu__link">Lien E</a>
                        </li>
                    </ul>
                </nav>
            </div>
        </div>

        <main class="l-main">
            <div class="wrap">
                <h1>Responsive menu</h1>
                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Soluta, repellat, ducimus quidem doloribus inventore sunt in officiis esse. Eos commodi cum maxime, sapiente beatae dolorum quidem, nisi ratione fugit et.</p>
            </div>
        </main>
            
          
!
            
              @import "bourbon";

$clr0: #fff;
$clr1: #09f;

/* Base
-------------------------- */

body {
  background: $clr0;
  color: #454545;
}

a {
  color: $clr1;
  &:hover{
      color: darken($clr1, 10%);
   }
}

button {
  -webkit-font-smoothing: antialiased;
  background-color: $clr1;
  border: none;
  border-radius: 0.1875em;
  color: white;
  display: inline-block;
  font-size: 1em;
  font-weight: bold;
  line-height: 1;
  padding: .75em 1em;
  text-decoration: none;
  &:hover{
      background-color: darken($clr1, 10%);
      color: white;
   }
}


/* Header
-------------------------- */

.l-header {
	height: 80px;
	position: relative;
	background: #212121;
}

.logo {
	float: left;
   &__title {
     margin: 0;
   }
	&__link {
		display: inline-block;
      text-decoration: none;
		padding: 0 10px;
		line-height: 80px;
		height: 80px;
		color: #fff;
		word-wrap: no-wrap;
	}
}

.menu-btn {
	display: none;
	position: absolute;
	right: 10px;
	top: 20px;
}

@media (max-width: 768px){
	.logo {
		float: none;
	}
	.menu-btn {
		display: block;
	}
}

/*  Menu
-------------------------- */

.menu {
	float: right;
	&__list {
		overflow: hidden;
      padding-left: 0;
      margin: 0;
      list-style: none;
	}
	&__item{
		float: left;
		text-align: center;
		text-align: center;
	}
	&__link{
		display: block;
      color: #fff;
      text-decoration: none;
		line-height:em(80, 16);
		height: em(80, 16);
		padding: 0 1.5em;
		word-wrap: no-wrap;
		transition: all .3s ease;
		&:hover, &:focus {
			background: $clr1;
			color: #fff;
		}
	}
}

@media (max-width: 768px){
	.menu {
		float: none;
		&__item{
			display: block;
			float: none;
			@include transform(translateX(-100%));
			transition: all .3s ease-out;
			&--play {
				display: block;
				@include transform(translateX(0));
			}
		}
		&__item + &__item {
			border-top: 1px solid darken($clr1, 5%);
		}
      &__link {
        background: $clr1;
        &:hover {
          background: darken($clr1, 10%);
        }
      }
	}
}

/* Wrap
-------------------------- */

.wrap {
	margin-left: auto;
	margin-right: auto;
	max-width: 1000px;
   .l-main & {
    padding: 0 10px;
  }
}
            
          
!
            
              $('.menu-btn').on('click', function() {

		var elem = $(this),
		    item = $('.menu__item'),
		    active = 'is-active',
		    play = 'menu__item--play';

		if (  elem.hasClass(active) ) {
			elem.removeClass(active);
			$(item.get().reverse()).each(function(i) {
				var row = $(this);
					setTimeout(function() {
						row.removeClass(play);
				}, 50*i);
			});
		}

		else {
			elem.addClass(active);
			item.each(function(i) {
				var row = $(this);
					setTimeout(function() {
						row.addClass(play);
				}, 50*i);
			});
		}

	});
            
          
!
999px
Loading ..................

Console