"Accordion"
Pure CSS 1.0.0 Snippet by ayaz11244

<link href="//cdnjs.cloudflare.com/ajax/libs/pure/1.0.0/pure-min.css" rel="stylesheet" id="bootstrap-css"> <script src=""></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <div class="acc"> <div class="acc-container"> <div class="acc-head"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </div> <div class="acc-content"> Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </div> </div> <div class="acc-container"> <div class="acc-head"> Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. </div> <div class="acc-content"> Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. </div> </div> </div> </div> </div>
.acc { margin-bottom: 10px; } .acc-head { background-color: rgb(155, 154, 87); padding: 15px 10px; font-size: 22px; position: relative; cursor: pointer; } .acc-head::before, .acc-head::after { content: ''; position: absolute; top: 50%; background-color: #fff; transition: all .3s; } .acc-head::before { right: 30px; width: 3px; height: 20px; margin-top: -10px; } .acc-head::after { right: 21px; width: 20px; height: 3px; margin-top: -2px; } .acc-head p { color: #fff; font-weight: bold; } .acc-content { padding: 15px 10px; display: none; } .acc-head.active::before { transform: rotate(90deg); }
$(document).ready(function() { $('.acc-container .acc:nth-child(1) .acc-head').addClass('active'); $('.acc-container .acc:nth-child(1) .acc-content').slideDown(); $('.acc-head').on('click', function() { if($(this).hasClass('active')) { $(this).siblings('.acc-content').slideUp(); $(this).removeClass('active'); } else { $('.acc-content').slideUp(); $('.acc-head').removeClass('active'); $(this).siblings('.acc-content').slideToggle(); $(this).toggleClass('active'); } }); });

Related: See More


Questions / Comments: