Skip to content

Instantly share code, notes, and snippets.

@rblakejohnson
Created September 23, 2013 16:01
Show Gist options
  • Save rblakejohnson/6672767 to your computer and use it in GitHub Desktop.
Save rblakejohnson/6672767 to your computer and use it in GitHub Desktop.
JS: FAQ toggle and close
$('.question').on('click', function(e) {
e.preventDefault();
var self = $(this);
self.toggleClass("active").next().slideToggle(350);
});
$('.answer .close').on('click', function(e) {
e.preventDefault();
var answer = $(this).parents(".answer");
answer.slideUp(350);
answer.prev().removeClass('active');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment