JSFiddle - React, Tailwind, and code Playground
by luchaninov
HTML
<script src="https://raw.github.com/YuriyLuchaninov/tagjs/master/tag.js"></script>
<script src="https://raw.github.com/YuriyLuchaninov/tagjs/master/examples/accordion/accordion.js"></script>
<accn id="accordion">
<accn-page class="open">
<accn-header>Menu</accn-header>
<accn-content>
<ul class="menu">
<li><a href="#">Menu</a></li>
<li><a href="#">Menu</a></li>
<li><a href="#">Menu</a></li>
<li><a href="#">Menu</a></li>
<li><a href="#">Menu</a></li>
</ul>
</accn-content>
</accn-page>
<accn-page>
<accn-header>Content</accn-header>
<accn-content>
<div class="content">
Content
</div>
</accn-content>
</accn-page>
<accn-page>
<accn-header>Header</accn-header>
<accn-content>
<div class="content">
Content
</div>
</accn-content>
</accn-page>
<accn-page>
<accn-header>Header</accn-header>
<accn-content>
<div class="content">
Content
</div>
</accn-content>
</accn-page>
<accn-page>
<accn-header>Header</accn-header>
<accn-content>
<div class="content">
Content
</div>
</accn-content>
</accn-page>
<accn-page>
<accn-header>Header</accn-header>
<accn-content>
<div class="content">
Content
</div>
</accn-content>
</accn-page>
</accn>
CSS
/*default*/
html,
body{
margin: 0;
padding: 0;
height: 100%;
}
body {
font: 14px/20px 'Arial';
color: #333;
margin: 0 auto;
width: 300px;
}
ul{
margin: 0;
padding: 0;
list-style: none;
}
.menu a{
color: #333;
display: block;
padding:5px 10px;
text-decoration: none;
}
.menu a:hover{
background: rgba(0,0,0,0.1);
}
.content {
padding: 5px 10px;
}
/*component*/
.accordion {
width: 100%;
height: 100%;
background: #fdfdfd;
}
.accordion-page-content {
overflow: hidden;
height: 0;
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-o-transition: all 1s ease;
-ms-transition: all 1s ease;
transition: all 1s ease;
}
/*Style*/
.accordion-page-header{
font-weight: bold;
color: #172c47;
text-shadow: 1px 1px 0 #3e88cb, 0 0 1px #31659a, 0 0 1px #31659a;
cursor: pointer;
padding: 10px;
background: #429ee5;
background: -moz-linear-gradient(top, #429ee5 0%, #1e5799 100%);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#429ee5), color-stop(100%,#1e5799));
background: -webkit-linear-gradient(top, #429ee5 0%,#1e5799 100%);
background: -o-linear-gradient(top, #429ee5 0%,#1e5799 100%);
background: -ms-linear-gradient(top, #429ee5 0%,#1e5799 100%);
background: linear-gradient(to bottom, #429ee5 0%,#1e5799 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#429ee5', endColorstr='#1e5799',GradientType=0 );
}
.accordion-page:nth-child(odd) .accordion-page-content{
background: #f0f0f0;
}
JavaScript
$TB.apply(document.getElementById('accordion'));