-
-
Save WPDC/a3315c07c83124cac58e to your computer and use it in GitHub Desktop.
CS0110 3.8 Abstraction in Action
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
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