Seeking assistance in creating an accordion that displays a snippet of content before collapsing.
I'm facing difficulty starting this project. While a basic accordion is simple to implement, I am unsure how to show a portion of the content (such as the first 30 characters) in a greyed-out format before collapsing the accordion.
My initial approach was inspired by a suggested structure with a "teaser" from this post. The goal is to have the teaser show a few initial characters from the content and disappear once the accordion is collapsed, revealing the full content.
If you have any insights or guidance on achieving this, it would be greatly appreciated.
<link href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/css/bootstrap.css" rel="stylesheet"/>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.js"></script>
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion"
href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Why a rose is what you need
</a>
</h4>
</div>
<div class="panel-teaser panel-body" style="color:#d9d9d9" >
A rose is the ideal flower you need because...
</div>
<div id="collapseOne" class="panel-collapse collapse in"
role="tabpanel" aria-labelledby="headingOne">
<div class="panel-body">
A rose is the ideal flower you need because it's the flower all girls love to get. Offer one for Valentine's Day and she'll be yours blablabla
</div>
</div>
</div>
</div>