1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
jQuery(document).ready(function() {
	// Initialize to closed
	jQuery('.wp-super-faq-answer').hide();

	// If a closed question is clicked
	jQuery('.wp-super-faq-question-closed').live('click', function(event) {
		event.preventDefault();
		var wp_super_faq_id = '#' + jQuery(this).attr('id');
		jQuery(this).removeClass().addClass('wp-super-faq-question-open');
		jQuery(wp_super_faq_id + ' .wp-super-faq-triangle').html('▼');
		jQuery('.wp-super-faq-answer' + wp_super_faq_id + '-answer').slideDown();
		
	});
	
	// If an open question is clicked
	jQuery('.wp-super-faq-question-open').live('click', function(event) {
		event.preventDefault();
		var wp_super_faq_id = '#' + jQuery(this).attr('id');
		jQuery(this).removeClass().addClass('wp-super-faq-question-closed');
		jQuery(wp_super_faq_id + ' .wp-super-faq-triangle').html('▶');
		jQuery('.wp-super-faq-answer' + wp_super_faq_id + '-answer').slideUp();
	});
});