Skip to content

Instantly share code, notes, and snippets.

@WPDC
Last active December 14, 2015 05:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WPDC/a3315c07c83124cac58e to your computer and use it in GitHub Desktop.
Save WPDC/a3315c07c83124cac58e to your computer and use it in GitHub Desktop.
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