jQuery(document).ready(function($){ $open_all = thfaq_vars.getoption; if($('.thfaq_accordion-open').removeClass("thfaq-active")){ $('.thfaq_accordion-open').addClass("thfaq-active"); $('.thfaq_panel-open').css('display','block');//firest title open } $('.thfaq_accordion').click(function(){//activate click function if($open_all=='true'){ $(this).next().slideToggle('slow'); if($(this).hasClass("thfaq-active")){ $(this).removeClass("thfaq-active"); }else{ $(this).addClass("thfaq-active"); } } if($open_all==''){ $(this).closest('.thfaq_faq_group').find('.thfaq_panel').slideUp('slow'); if($(this).hasClass("thfaq-active")){ //$(this).next().slideUp('slow'); $(this).closest('.thfaq_faq_group').find('.thfaq-active').removeClass("thfaq-active"); }else{ $(this).closest('.thfaq_faq_group').find('.thfaq-active').removeClass("thfaq-active"); $(this).next().slideDown('slow'); $(this).addClass("thfaq-active"); } } }); });