"accordion"
Bootstrap 3.0.0 Snippet by evarevirus

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <!DOCTYPE html><html class=''> <head><script src='//production-assets.codepen.io/assets/editor/live/console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/events_runner-73716630c22bbc8cff4bd0f07b135f00a0bdc5d14629260c3ec49e5606f98fdd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/css_live_reload_init-2c0dc5167d60a5af3ee189d570b1835129687ea2a61bee3513dee3a50c115a77.js'></script><meta charset='UTF-8'><meta name="robots" content="noindex"><link rel="shortcut icon" type="image/x-icon" href="//production-assets.codepen.io/assets/favicon/favicon-8ea04875e70c4b0bb41da869e81236e54394d63638a1ef12fa558a4a835f1164.ico" /><link rel="mask-icon" type="" href="//production-assets.codepen.io/assets/favicon/logo-pin-f2d2b6d2c61838f7e76325261b7195c27224080bc099486ddd6dccb469b8e8e6.svg" color="#111" /><link rel="canonical" href="https://codepen.io/vikasverma93/pen/raxGaM?limit=all&page=2&q=Accordion" /> <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css'><link rel='stylesheet prefetch' href='https://fonts.googleapis.com/css?family=Open+Sans:400,600'><link rel='stylesheet prefetch' href='//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css'> <style class="cp-pen-styles">body{ background-color: #567; font-family: 'Open Sans', sans-serif; } .accordion-container{ position: relative; width: 500px; height: auto; margin: 20px auto; } .accordion-container > h2{ text-align: center; color: #fff; padding-bottom: 5px; margin-bottom: 30px; border-bottom: 1px solid #ddd; } .set{ position: relative; width: 100%; height: auto; background-color: #f5f5f5; } .set > a{ display: block; padding: 10px 15px; text-decoration: none; color: #555; font-weight: 600; border-bottom: 1px solid #ddd; -webkit-transition:all 0.2s linear; -moz-transition:all 0.2s linear; transition:all 0.2s linear; } .set > a i{ position:relative; float: right; margin-top:4px; color: #666; } .set > a.active{ background-color:#3399cc; color: #fff; } .set > a.active i{ color: #fff; } .content{ position:relative; width: 100%; height: auto; background-color: #fff; border-bottom: 1px solid #ddd; display:none; } .content p{ padding: 10px 15px; margin: 0; color: #333; }</style></head><body> <div class="accordion-container"> <h2>jQuery Accordion</h2> <div class="set"> <a href="#"> Vestibulum <i class="fa fa-plus"></i> </a> <div class="content"> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna.</p> </div> </div> <div class="set"> <a href="#"> Phasellus <i class="fa fa-plus"></i> </a> <div class="content"> <p> Aliquam cursus vitae nulla non rhoncus. Nunc condimentum erat nec dictum tempus. Suspendisse aliquam erat hendrerit vehicula vestibulum.</p> </div> </div> <div class="set"> <a href="#"> Praesent <i class="fa fa-plus"></i> </a> <div class="content"> <p>Pellentesque aliquam ligula libero, vitae imperdiet diam porta vitae. sed do eiusmod tempor incididunt ut labore et dolore magna.</p> </div> </div> <div class="set"> <a href="#"> Curabitur <i class="fa fa-plus"></i> </a> <div class="content"> <p> Donec tincidunt consectetur orci at dignissim. Proin auctor aliquam justo, vitae luctus odio pretium scelerisque. </p> </div> </div> </div> <script src='//production-assets.codepen.io/assets/common/stopExecutionOnTimeout-b2a7b3fe212eaa732349046d8416e00a9dec26eb7fd347590fbced3ab38af52e.js'></script><script src='//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script >$(document).ready(function(){ $(".set > a").on("click", function(){ if($(this).hasClass('active')){ $(this).removeClass("active"); $(this).siblings('.content').slideUp(200); $(".set > a i").removeClass("fa-minus").addClass("fa-plus"); }else{ $(".set > a i").removeClass("fa-minus").addClass("fa-plus"); $(this).find("i").removeClass("fa-plus").addClass("fa-minus"); $(".set > a").removeClass("active"); $(this).addClass("active"); $('.content').slideUp(200); $(this).siblings('.content').slideDown(200); } }); }); //# sourceURL=pen.js </script> </body></html>

Related: See More


Questions / Comments: