Skip to content

Instantly share code, notes, and snippets.

@zdimaz
Created June 17, 2019 13:28
Show Gist options
  • Save zdimaz/87441d2993e66f65af89d74be42d33ae to your computer and use it in GitHub Desktop.
Save zdimaz/87441d2993e66f65af89d74be42d33ae to your computer and use it in GitHub Desktop.
js accordion
/**
** nextOpen
**/
accordion: function(){
var self = this;
$(".set > a").on("click", function(){
if($(this).hasClass('active')) {
$(this).removeClass("active");
$(this).siblings('.accordion_content').slideUp(200);
$(".set > a i").removeClass("fa-angle-down").addClass("fa-angle-right");
}
else {
$(".set > a i").removeClass("fa-angle-down").addClass("fa-angle-right");
$(this).find("i").removeClass("fa-angle-right").addClass("fa-angle-down");
$(".set > a").removeClass("active");
$(this).addClass("active");
$('.accordion_content').slideUp(200);
$(this).siblings('.accordion_content').slideDown(200);
}
});
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment