dwcouch
Member
Posted 11 months ago #
I was looking to leverage css for the selected FAQ and close the non-selected FAQ while using the category slug short-code.
The 'stop()' avoids UI bugs if some-one gets click-happy.
Great Plug-in!
faq-collapse.js
jQuery(document).ready(function () {
jQuery(".faq_answer").hide();
jQuery(".faq_question").click(function () {
jQuery(".faq_answer").not(this).hide().parent().removeClass("currentFaq");
jQuery(this).stop().next(".faq_answer").slideToggle(200).parent().addClass("currentFaq");
});
});
Hadn't even thought about folks getting click-happy. I'm getting ready to push out a pretty big update that includes jQuery ajax pagination, so I'll test this along with it to make sure there are no conflicts. Thanks!
Tested your code. It works well, however, it loses the ability to close an individual FAQ if you want to. I'm gonna play with it some more and see about including it in a future release. Thanks again!
dwcouch
Member
Posted 9 months ago #
Funny, I hadn't thought about closing a FAQ once it opened.
Thanks for the replay, I'm glad I could be of help!
~D