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.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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: ul#accordion.accordion
  li.accordion__list
    .link
      i.fa.fa-paint-brush
      span.link__title Menu 1
      i.fa.fa-chevron-down
    ul.submenu
      li: a(href='javascript://') submenu 1
      li: a(href='javascript://') submenu 1
      li: a(href='javascript://') submenu 1
      li: a(href='javascript://') submenu 1
  li.accordion__list
    .link
      i.fa.fa-code
      span.link__title Menu 2
      i.fa.fa-chevron-down
    ul.submenu
      li: a(href='javascript://') submenu 2
      li: a(href='javascript://') submenu 2
      li: a(href='javascript://') submenu 2
      li: a(href='javascript://') submenu 2
  li.accordion__list
    .link
      i.fa.fa-mobile
      span.link__title Menu 3
      i.fa.fa-chevron-down
    ul.submenu
      li: a(href='javascript://') submenu 3
      li: a(href='javascript://') submenu 3
      li: a(href='javascript://') submenu 3
      li: a(href='javascript://') submenu 3
  li.accordion__list
    .link
      i.fa.fa-globe
      span.link__title Menu 4
      i.fa.fa-chevron-down
    ul.submenu
      li: a(href='javascript://') submenu 4
      li: a(href='javascript://') submenu 4
      li: a(href='javascript://') submenu 4
      li: a(href='javascript://') submenu 4

            
          
!
            
                $primary : #37474F !global;
	$secondary : #ECEFF1 !global;
	$tertiary : #ff5252 !global;

@mixin flexbox {
		display: -webkit-box;
		display: -webkit-flex;
		display: -moz-flex;
		display: -ms-flexbox;
		display: flex;
	}

	@mixin flex-direction($value: row) {
		@if $value == row-reverse {
			-webkit-box-direction: reverse;
			-webkit-box-orient: horizontal;
		} @else if $value == column {
			-webkit-box-direction: normal;
			-webkit-box-orient: vertical;
		} @else if $value == column-reverse {
			-webkit-box-direction: reverse;
			-webkit-box-orient: vertical;
		} @else {
			-webkit-box-direction: normal;
			-webkit-box-orient: horizontal;
		}
		-webkit-flex-direction: $value;
		-moz-flex-direction: $value;
		-ms-flex-direction: $value;
		flex-direction: $value;
	}
	@mixin justify-content($value: flex-start) {
		@if $value == flex-start {
			-webkit-box-pack: start;
			-ms-flex-pack: start;
		} @else if $value == flex-end {
			-webkit-box-pack: end;
			-ms-flex-pack: end;
		} @else if $value == space-between {
			-webkit-box-pack: justify;
			-ms-flex-pack: justify;
		} @else if $value == space-around {
			-ms-flex-pack: distribute;
		} @else {
			-webkit-box-pack: $value;
			-ms-flex-pack: $value;
		}
		-webkit-justify-content: $value;
		-moz-justify-content: $value;
		justify-content: $value;
	}
	@mixin align-items($value: stretch) {
		@if $value == flex-start {
			-webkit-box-align: start;
			-ms-flex-align: start;
		} @else if $value == flex-end {
			-webkit-box-align: end;
			-ms-flex-align: end;
		} @else {
			-webkit-box-align: $value;
			-ms-flex-align: $value;
		}
		-webkit-align-items: $value;
		-moz-align-items: $value;
		align-items: $value;
	}
	@mixin flex-wrap($value: nowrap) {
		// No Webkit Box fallback.
		-webkit-flex-wrap: $value;
		-moz-flex-wrap: $value;
		@if $value == nowrap {
			-ms-flex-wrap: none;
		} @else {
			-ms-flex-wrap: $value;
		}
		flex-wrap: $value;
	}
	@mixin transition($time){
		-webkit-transition: all $time ease;
		-moz-transition: all $time ease;
		-o-transition: all $time ease;
		-ms-transition: all $time ease;
		transition: all $time ease;
	}

//Reset básico -- Basic reset
	* {
		box-sizing: border-box;
		margin: 0;
		padding: 0;
		text-decoration: none;
		font-weight: normal;
		font-family: 'Lato';
		color: #f5f5f5;
	}

body {
	background: $tertiary;
	font-family: 'Open Sans', Helvetica, Arial, Verdana, sans-serif;
}

.container{
  width: 100%;
  //min-width: 768px;
  max-width: 500px;
  margin: auto;
}
a {
	color: #b63b4d;
}

/** ==========================
* Conentendor Principal
=============================
**/

.accordion {
	width: 100%;
	margin: 3em auto 2em;
	-webkit-border-radius: 4px;
	-moz-border-radius: 4px;
	border-radius: 4px;
  box-shadow:
      0 1px 2px 0 rgba(0, 0, 0, 0.16),
      0 1px 5px 0 rgba(0, 0, 0, 0.12);
  @include flexbox;
  @include flex-wrap(wrap);
  &__list{
	  background: #FFF;
    width: 100%;
    & .link {
      font-size: 0.85em;
      font-weight: 700;
      color: $primary;

      cursor: pointer;
      border-bottom: 1px solid #ccc;
      display: block;
      position: relative;
      -webkit-transition: all 0.4s ease;
      -moz-transition: all 0.4s ease;
      -moz-transition: all 0.4s ease;
      -o-transition: all 0.4s ease;
      transition: all 0.4s ease;
      &__title{
        padding: 1.5em;
        padding-left: 3em;
        position: relative;
        box-sizing: border-box;
        width: 100%;
        display: block;
        background-color: transparent;
        color: $primary;
      }
    }
  }
  & li:last-child .link {
    border-bottom: 0;
  }
  
}

/** ========================
* Diseño iconos font-awesome
============================= **/

.accordion li i {
	position: absolute;
	top: 1.5em;
	left: 1rem;

	font-size: 1em;
	color: #595959;

	-webkit-transition: all 0.4s ease;
  -moz-transition: all 0.4s ease;
	-o-transition: all 0.4s ease;
	transition: all 0.4s ease;
}

.accordion li i.fa-chevron-down {
	right: 12px;
	left: auto;

	font-size: 1.2em;

}
/**===================================
* Conf. clase link al estar activo submenu (con js)
====================================**/
.accordion li.open .link {
	color: $tertiary;
}
.accordion li.open i {
	color: $tertiary;
}
.accordion li.open i.fa-chevron-down {
	-webkit-transform: rotate(180deg);
  -moz-transform: rotate(180deg);
	-ms-transform: rotate(180deg);
	-o-transform: rotate(180deg);
	transform: rotate(180deg);
}

/**=======================
* Submenu
==========================**/
.submenu {
	display: none;
	background: #444359;
	font-size: 0.95em;
}
.submenu li {
	border-bottom: 1px solid #4b4a5e;
}
.submenu a {
	display: block;
	text-decoration: none;
	color: #d9d9d9;
	padding: 1rem;
	padding-left: 3.5em;
	-webkit-transition: all 0.25 ease;
  -moz-transition: all 0.25 ease;
	-o-transition: all 0.25 ease;
	transition: all 0.25 ease;
}
.submenu a:hover {
	background: #b63b4d;
	color: #fff;
}
            
          
!
            
              /*Codigo referencia de Creaticode*/

/* Class HTML
* accordion, que corresponde al contenedor del menu, en este caso <ul>
* open, se agregará a los li padre al ejecutar las funciones javascript
* link, corresponde a el contenedor de los <i> y el titulo de cada submenu
* submenu, corresponde a el submenu y se aplica a <ul> hijo de <li>
*/

/* Id HTML
* accordion, identifica al menu tipo acordion, en este caso <ul> padre
*/


$(function(){
	var Accordion = function(el, multiple) {
		this.el = el || {};
		this.multiple = multiple || false;

		// Variables
		var link = this.el.find('.link');
		// Eventos
		link.on('click', {el: this.el, multiple: this.multiple},this.dropdown)
	}

	Accordion.prototype.dropdown = function(e) {
		var $el = e.data.el;
			$this = $(this),
			$next = $this.next();

		// Desencadena evento de apertura en los elementos siguientes a la clase link = ul.submenu
		$next.slideToggle();
		// Agregar clase open a elemento padre del elemento con clase link = li
		$this.parent().toggleClass('open');
		
		//Parametro inicial que permite ver 1 solo submenu abierto 
		if(!e.data.multiple){
			$el.find('.submenu').not($next).slideUp().parent().removeClass('open');
		}
    
	}
	// Elegir submenus multiples (true) submenus uno a la vez (false)
	var accordion = new Accordion($('#accordion'), false);
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console