OzRamos, I added the line of code as you recommended, but it didn’t work. The first div did not expand on page load. Did I do something wrong. Any other suggestions?
<script type="text/javascript">
$(document).ready(function () {
$('.accordion-toggle').on('click', function(event){
event.preventDefault();
// create accordion variables
var accordion = $(this);
var accordionContent = accordion.next('.accordion-content');
var accordionToggleIcon = $(this).children('.toggle-icon');
// toggle accordion link open class
accordion.toggleClass("open");
// toggle accordion content
accordionContent.slideToggle(250);
// change plus/minus icon
if (accordion.hasClass("open")) {
accordionToggleIcon.html("<i class='fa fa-minus'></i>");
} else {
accordionToggleIcon.html("<i class='fa fa-plus'></i>");
}
$('.accordion-toggle').first().click();
});
});
</script>
Again that would be the easiest way. I don’t know how much control you have over the output of the content, but if you could apply a class of “default-open” to one of the accordions, example:
<script type="text/javascript">
$(document).ready(function () {
$('.accordion-toggle').on('click', function(event){
event.preventDefault();
// create accordion variables
var accordion = $(this);
var accordionContent = accordion.next('.accordion-content');
var accordionToggleIcon = $(this).children('.toggle-icon');
// toggle accordion link open class
accordion.toggleClass("open");
// toggle accordion content
accordionContent.slideToggle(250);
// change plus/minus icon
if (accordion.hasClass("open")) {
accordionToggleIcon.html("<i class='fa fa-minus'></i>");
} else {
accordionToggleIcon.html("<i class='fa fa-plus'></i>");
}
});
$('.default-open').click();
});
</script>
I’m out of time right now so maybe someone else can help but this will only work if you load the page in “browser mode” (small width). You’ll need to add a little more logic so that it auto-opens the first accordion if you decrease the browser width.