Reputation: 579
I am using jQuery to hide some content in collapsible panels, to do this I am using the following mark up and script:
HTML
<div class="trigger">Collapsible Header 1 - Click to toggle</div>
<div class="panel">
content 1
</div>
<div class="trigger">Collapsible Header 2 - Click to toggle</div>
<div class="panel">
content 2
</div>
jQuery:
$(document).ready(function() {
$(".trigger").click(function(){
$(this).next(".panel").slideToggle("medium");
});
});
A fiddle of it here:
This works great, however I am trying to start with the panels collapsed. Currently, they are open, not closed. What is the best approach to start with the panels collapsed?
Upvotes: 0
Views: 20