jQuery(document).ready(function() { /* VARIABLE */ var coll = $('.collapsible'); var i; /* EVENTS */ coll.click(function() { $(this).toggleClass('active'); $content = $(this).next(); $content.slideToggle(200, function () {}); }); /* INIT */ coll.each(function() { if ($(this).is('.active')) { $content = $(this).next(); $content.slideToggle(10, function () {}); } }); });