Skip to content

Instantly share code, notes, and snippets.

@francoispeyret
Created June 20, 2018 13:47
Show Gist options
  • Save francoispeyret/6186d4f3860b29da26a3ab35d5cd63a6 to your computer and use it in GitHub Desktop.
Save francoispeyret/6186d4f3860b29da26a3ab35d5cd63a6 to your computer and use it in GitHub Desktop.
faq.js improvement slideToggle
/**
* Roll out answer
*/
$(".gomakoil_faq_page .questions").click(function (e) {
e.preventDefault();
var answer_page_link = $(this).find(".icon_fag");
var answer_block = $(this).next();
if ($(this).hasClass('as_url')) {
location.href = answer_page_link.attr('href');
return false;
}
if ($(this).hasClass('active')) {
$(this).removeClass('active');
answer_page_link.hide();
} else {
$(this).addClass('active');
answer_page_link.fadeIn();
}
// AXOME : add stop() function to clear animation's queue
answer_block.stop(true).slideToggle("slow");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment