Created
September 23, 2013 16:01
-
-
Save rblakejohnson/6672767 to your computer and use it in GitHub Desktop.
JS: FAQ toggle and close
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('.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