Reputation: 3
I need some help with this accordion. Please see the demo here. http://jsfiddle.net/a36RL/
$(document).ready(function() {
$('div.accordionButton').click(function() {
$('div.accordionContent').slideUp('slow');
$(this).next().slideDown('slow');
});
$("div.accordionContent").hide();
});
I need to make a little changes in it.
Thanks for the help.
Upvotes: 0
Views: 79
Reputation: 82933
You can trigger the click event on the first button to open the first tab. Try this:
$(document).ready(function() {
$('div.accordionButton').click(function() {
if($(this).next().is(":visible")){
return;
}
$('div.accordionContent').slideUp('slow');
$(this).next().slideDown('slow');
});
$("div.accordionContent").hide();
$("div.accordionButton:eq(0)").click();
});
Working example @:
Upvotes: 1