Skip to content

Instantly share code, notes, and snippets.

@WPDC
Last active Dec 14, 2015
Embed
What would you like to do?
CS0110 3.8 Abstraction in Action
function _qa() {
$('.qa-question').on('click', function() {
var $answer = $(this).next('.qa-answer');
if ( $(this).hasClass('opened') ) {
_closeQA( $answer, $(this) );
} else {
_openQA( $answer, $(this) );
}
$answer = null;
});
}
function _openQA( $answer, $container ) {
if ( $answer.hasClass('closed') ) {
$answer.removeClass('closed');
}
$container.addClass('opened');
$answer.slideDown();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment