Anchor plus minus sign in non-accordion
-
When it is not in accordion behaviour and open multiple question opened and closed, anchor plus and minus sign does not behave exactly as it should. following code will fix it.
jQuery(document).ready(function ($) { var faqContainer = $(".qafp-faqs"); // <- add $("div[id^=qafp-faq]").each(function () { var num = this.id.match(/qafp-faq(\d+)/)[1]; var faq = $("#qafp-faq" + num); //var faqContainer = $(".qafp-faqs"); // <- remove if (faqContainer.is(".collapsible")) { faq.find(".qafp-faq-anchor").bind("click", function () { if (faqContainer.is(".accordion")) $(".qafp-faq-answer").not("#qafp-faq" + num + " .qafp-faq-answer").hide(); if (faqContainer.is(".animation-fade")) faq.find(".qafp-faq-answer").fadeToggle(); else if (faqContainer.is(".animation-slide")) faq.find(".qafp-faq-answer").slideToggle(); else faq.find(".qafp-faq-answer").toggle(); if (faqContainer.is(".focus")) { theOffset = $(this).offset(); $(window).scrollTop(theOffset.top - 50) } return false }); $(".expand-all.expand").bind("click", function () { $(".expand-all.expand").hide(); $(".expand-all.collapse").show(); if (faqContainer.is(".animation-fade")) $(".qafp-faq-answer").fadeIn(400); else if (faqContainer.is(".animation-slide")) $(".qafp-faq-answer").slideDown(); else $(".qafp-faq-answer").show() }); $(".expand-all.collapse").bind("click", function () { $(".expand-all.collapse").hide(); $(".expand-all.expand").show(); if (faqContainer.is(".animation-fade")) $(".qafp-faq-answer").fadeOut(400); else if (faqContainer.is(".animation-slide")) $(".qafp-faq-answer").slideUp(); else $(".qafp-faq-answer").hide() }) } }); $(".qafp-faq-anchor").click(function () { if ($(this).find('.qafp-fa-caret-right').hasClass('qafp-fa-open')) { $(this).find('.qafp-fa-caret-right').removeClass('qafp-fa-open'); } else { if (faqContainer.is(".accordion")) // <- add $('.qafp-fa-open').removeClass("qafp-fa-open", 1000); $(this).find(".qafp-fa-caret-right").addClass("qafp-fa-open", 1000); return false; } }); $("#qafp_searchform").submit(function () { link = $(this).find("#qafp_search_link").val(); query = $(this).find(".qafp_search").val(); query = query.split(" ").join("+"); link = link + query; location.href = link; return false }) });
[Moderator Note: Please post code or markup between backticks or use the code button. Or better still – use a pastebin. Your posted code may now have been permanently damaged by the forum’s parser.]
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Anchor plus minus sign in non-accordion’ is closed to new replies.