I'm trying to create an accordion where a first part of the content is already visible before you collapse it.
The problem is that I just have no idea where to start this. A basic accordion is easy, but how can I display the beginning of the content (e.g the first 30 characters of the content greyed out) before the accordion is collapsed ?
I started with the structure suggested with a "teaser" from this post. I'd like that "teaser" to be the first couple characters shown from the content and when you click to collapse, the main content is displayed and the teaser disappears.
Any idea how to do that ?
<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>