"jquerrryyy aaccccorddiannnn"
Bootstrap 4.1.1 Snippet by ravic9089

<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></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="content"> <div class="accordion"> <div class="accordion__item open-accordion"> <div class="accordion__header">Tired of how boring Lorem Ipsum got?</div> <div class="accordion__body"> <p>Cupcake ipsum dolor sit amet halvah. Tootsie roll jelly beans croissant brownie bear claw dragée chupa chups muffin. Pudding tiramisu lollipop fruitcake lemon drops liquorice. Chocolate bar cupcake cake.</p> </div> </div> <div class="accordion__item"> <div class="accordion__header">Pretty sweet, right?</div> <div class="accordion__body"> <p>Carrot cake powder tart jelly beans. Chocolate bar chupa chups oat cake jelly sesame snaps. Jelly-o bonbon sugar plum cotton candy dessert biscuit cake cookie sweet roll. Cake apple pie soufflé tiramisu. Cotton candy cotton candy cupcake topping cake cheesecake marzipan marshmallow. Sweet bear claw wafer marzipan biscuit ice cream chocolate cake.</p> </div> </div> <div class="accordion__item"> <div class="accordion__header">What is Cupcake Ipsum?</div> <div class="accordion__body"> <p>Cookie pudding bonbon candy canes chocolate pie brownie chocolate bear claw. Tootsie roll wafer jujubes oat cake chocolate cake cupcake gingerbread. Jelly tiramisu tiramisu wafer macaroon tiramisu liquorice toffee.</p> </div> </div> <div class="accordion__item"> <div class="accordion__header">Tired of how boring Lorem Ipsum got?</div> <div class="accordion__body"> <p>Cake lemon drops cotton candy powder gingerbread wafer gummi bears. Cupcake brownie fruitcake caramels dragée pastry cupcake gingerbread lollipop. Chupa chups jelly jelly beans cake cookie chupa chups cake marshmallow.</p> </div> </div> </div> </div>
@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@300;400;600;700&display=swap'); * { margin: 0; padding: 0; box-sizing: border-box; } html { font-size: 100%; } body { background: #d8eefe; font-family: 'Raleway', sans-serif; } .content { margin: 80px auto; max-width: 580px; } .accordion__item { background: #fffffe; border-radius: 4px; } .accordion__item:not(:last-child) { margin-bottom: 15px; } .accordion__header { padding: 20px; padding-right: 50px; font-weight: 600; font-size: 1.25rem; color: #094067; position: relative; cursor: pointer; } .accordion__header::after { content: ''; display: block; width: 18px; height: 18px; position: absolute; right: 20px; top: 0; bottom: 0; margin: auto; background: url("https://cdn.statically.io/gist/koptyaisky/33f5da3d9e6b6cacdf5a353ad033c2ea/raw/c8468a17e0141ee82a2571deea1f76162abb47b6/arrow-down-blue.svg") no-repeat center; background-size: contain; transition: all .4s ease; } .accordion__body { padding: 0 40px 20px 20px; font-weight: 300; font-size: 0.875rem; color: #5f6c7b; line-height: 1.5; display: none; } .open-accordion .accordion__body { display: block; } .open-accordion .accordion__header::after { transform: rotate(-180deg); }
$(document).ready(function() { $('.accordion__header').click(function() { $(".accordion__body").not($(this).next()).slideUp(400); $(this).next().slideToggle(400); $(".accordion__item").not($(this).closest(".accordion__item")).removeClass("open-accordion"); $(this).closest(".accordion__item").toggleClass("open-accordion"); }); });

Related: See More


Questions / Comments: