I've been troubling myself to achieve this with twitter bootstrap accordion:
Generally, using the accordion (bootstraps collapse plugin) is not a must.
What I want to achieve is to:
Would really love to get some help on this as I think I'm loosing my mind over this :(
The use of additional jQuery plugins (like jQuery UI) is "allowed".
I was able to achieve this with some JS:
var tabsHeight = $('.accordion-heading').outerHeight() * $('.accordion-heading').length;
var height = $('#your_accordion_container').innerHeight() - tabsHeight;
$('.accordion-inner').height(height - 1);
I haven't figured out why I need to do - 1
yet but without it the .accordion-inner
was too big.
Make sure to wrap this in a function and to call it every time the browser window gets resized. Also make sure that your .accordion-inner
doesn't have any vertical padding or to remove that padding from the set height.
HTML:
<div class="ui-accordion" id="accordion">
<h4 class="ui-accordion-header">DIV1</h4>
<div class="ui-accordion-content" id="accordion-div1"></div>
<h4 class="ui-accordion-header">DIV2</h4>
<div class="ui-accordion-content" id="accordion-div2"></div>
<h4 class="ui-accordion-header">DIV3</h4>
<div class="ui-accordion-content" id="accordion-div3"></div>
</div>
CSS: (nothing special)
JS:
$("#accordion").accordion( {
heightStyle : "fill"
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With