JSFiddle - React, Tailwind, and code Playground
Content Slider Accordion
HTML
<h2>jQuery Content Slider Accordion</h2>
<div class="accordion">
<span>What is "Lorum Ipsum"?</span>
</div>
<div class="accContent home">
<p><a href="http://www.lipsum.com">Lorem Ipsum</a> is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>
</div>
<div class="accordion">
<span>Where Does it Come From?</span>
</div>
<div class="accContent">
<p>Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source.</p>
</div>
<div class="accordion">
<span>Why Do We Use It?</span>
</div>
<div class="accContent">
<p>It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on...
CSS
@import url(http://fonts.googleapis.com/css?family=Raleway);
/*----------------------------
Basics for the Demo
-----------------------------*/
body {
margin: 10px 0;
background: #f8f8f8 url(http://jenniferperrin.com/images/bg.png);
color: #333;
font: 16px 'Raleway', sans-serif;
}
h2 {
color: #aa2c30;
font-weight: 600;
text-align: center;
border-bottom: 1px solid #c8c8c8;
border-top: 3px solid #ccc;
font-size: 24px;
line-height: 32px;
margin: 20px 0;
}
a {
color: #aa2c30;
text-decoration: none;
}
a:hover {
color: #487b7f;
transition: all 0.5s ease-in-out 0s;
}
.footer { margin-left: 20px; }
/*----------------------------
The Accordion
-----------------------------*/
.accordion {
width: 97%;
height: 50px;
cursor: pointer;
padding: 0 1em;
}
.accordion span {
border-bottom: 2px solid;
-webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.7);
-moz-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.7);
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.7);
display: inline-block;
padding: 6px 12px;
font-size: 24px;
line-height: 26px;
margin: 0;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.1);
background-color: #aa2c30;
border-bottom-color: #580022;
color: #f8f8f8;
}
.accordion span:hover {
background-color: #487b7f;
border-bottom-color: #333;
color: #f8f8f8;
}
.accContent {
width: 97%;
padding: 0 20px 20px;
}
/*----------------------------
Media Queries
-----------------------------*/
@media screen and (max-width: 600px) {
.accordion span { width: 93%; }
}
JavaScript
$(document).ready(function () {
// ----------------------------
// Accordion
// ----------------------------
$('.accordion').click(function () {
$('.accContent').slideUp('slow');
if ($(this).next().is(':hidden') == true) {
$(this).next().slideDown('slow');
}
});
$('.accContent').hide(); // Hide Content
$('.home').show(); // Show the "Home" content by Default
});