toggleClass support for faq title anchor
-
I added the code below to q-a-focus-plus.min.js
$( ".qafp-faq-anchor" ).click(function() { $( this).find( ".fa-caret-right" ).toggleClass( "open", 1000 ); return false; });
I also added this icon code to the shortcodes file:
<i class="fa fa-caret-right"></i>
Then I am using CSS to replace the icon with a down icon when the “open” class is toggled after clicking on the .qafp-faq-anchor link.
This works great and provides a good visual affordance for usability; however, I cannot figure out how to toggle the open class in conjunction with the accordion activated, meaning that the down facing icon that the open class triggers, stays visible when the accordion hides the answer div.
I understand that the answer is toggled through jquery, which switches out display none for display block on the answer div, but what would be great is if the qafp-faq class had an active or current class tied to it when the div is toggled.
That way we could use CSS to target the active div.
Since I am unsure of how to apply that active class or current class to the visible qafp-faq div, I’ve been trying to bind this behavior:
$( ".qafp-faq-anchor" ).click(function() { $( this).find( ".fa-caret-right" ).toggleClass( "open", 1000 ); return false; });
to the accordion functionality.
I would greatly appreciate either being able to add an active or current class to the visible answer, or having the click function I pasted above work when the accordion collapses open divs.
Thank you. Beautiful plugin.
I’ve spent hours trying to figure this out. Hair falling out.
https://www.ads-software.com/plugins/q-and-a-focus-plus-faq/
- The topic ‘toggleClass support for faq title anchor’ is closed to new replies.