Skip to content

Instantly share code, notes, and snippets.

@jadwigo
Last active February 1, 2016 13:45
Show Gist options
  • Save jadwigo/45a17e99236fd7a2f087 to your computer and use it in GitHub Desktop.
Save jadwigo/45a17e99236fd7a2f087 to your computer and use it in GitHub Desktop.
// FAQ
$('.faq .bodytext').hide(); // alle teksten sluiten
$('.faq h4.title').removeClass('open'); // alle "open" classes verwijderen
$('.faq h4.title').click(function() {
if($(this).hasClass('open')!=true) { // kijk of deze title al open is
$('.faq h4.title').removeClass('open'); // sluit alle open title
$('.faq .bodytext').slideUp('fast'); // sluit alle open teksten
$(this).parents('.faq').find('.bodytext').slideDown('fast'); // open deze tekst
$(this).addClass('open'); // voeg open class toe bij deze title
} else {
$(this).parents('.faq').find('.bodytext').slideUp('fast'); // sluit deze tekst
$(this).removeClass('open'); // verwijder class toe bij deze title
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment