Skip to content

Instantly share code, notes, and snippets.

@denniserdmann
Created July 6, 2016 08:46
Show Gist options
  • Save denniserdmann/29adfbcff9588340124c2d4993da43db to your computer and use it in GitHub Desktop.
Save denniserdmann/29adfbcff9588340124c2d4993da43db to your computer and use it in GitHub Desktop.
Contao Accordion - Closed by default (jQuery)
<script src="<?= TL_ASSETS_URL ?>assets/jquery/ui/<?= $GLOBALS['TL_ASSETS']['JQUERY_UI'] ?>/jquery-ui.min.js"></script>
<script>
(function($) {
$(document).ready(function() {
$(document).accordion({
// Put custom options here
heightStyle: 'content',
header: 'div.toggler',
collapsible: true,
active: false,
create: function(event, ui) {
ui.header.addClass('active');
$('div.toggler').attr('tabindex', 0);
},
activate: function(event, ui) {
ui.newHeader.addClass('active');
ui.oldHeader.removeClass('active');
$('div.toggler').attr('tabindex', 0);
}
});
});
})(jQuery);
</script>
@siyaramgurjar
Copy link

ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment