Reputation: 21
I found this fiddle https://codepen.io/LewisBriffa/pen/qjwqLb and it is great! My problem, is that I cant get the second panel to be closed by default on pageload.
I tried to add this:
<script>
$( function() {
$( ".accordion" ).accordion( { active: false, collapsible: true }
);
} );
</script>
But still it doesn't work
Any suggestions?
Upvotes: 0
Views: 2602
Reputation: 109
It's important to understand why Panel 2 is opened.
it's the ".active" class (like you already tried working with in your example)
So the simplest option is to just leave the class "active" out of the default class list of panel 2.
so you turn:
<div class="accordion__item js-accordion-item active">
into
<div class="accordion__item js-accordion-item">
hope this helps.
Upvotes: 1