Skip to content

Instantly share code, notes, and snippets.

@v-skochko
Last active March 11, 2016 15:01
Show Gist options
  • Select an option

  • Save v-skochko/0bf0d893530bf708fa94 to your computer and use it in GitHub Desktop.

Select an option

Save v-skochko/0bf0d893530bf708fa94 to your computer and use it in GitHub Desktop.
var accordionHeader = $('.faq_title'),
accordionContent = $('.description');
$(accordionHeader).click(function () {
if ($(this).hasClass('is-active')){
$(this).next(accordionContent).slideUp('fast');
$(this).removeClass('is-active');
}
else {
$(".faq_title span").html('+');
// close other content
$(accordionHeader).not(this).next(accordionContent).slideUp('fast');
$(accordionHeader).not(this).removeClass('is-active');
$(this).next(accordionContent).slideDown('fast');
$(this).addClass('is-active');
$(this).find('span').html('-');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment