Support Forum

  • Page:
  • 1

Tweak JB FAQ close\open effect

zentoolsIf you use Zentools please post a review at the Joomla! Extensions Directory.

Hey,

I saw before a post about tweaking the JB FAQ so when opening one question, all the others will automatically close so only one is open at same time.
the code was like this:
<script type="text/javascript">
jQuery.noConflict();
jQuery(function () {
	jQuery('div.answer<?php echo $id ?>,.bottom_controls<?php echo $id ?>').hide();
	jQuery('a.hide<?php echo $id ?>').click(function(){
			jQuery('div.answer<?php echo $id ?>').slideUp();
			jQuery('.faqtogglerdiv<?php echo $id ?> a.faqtoggler').removeClass("open");
			jQuery('.faqtogglerdiv<?php echo $id ?> a.faqtoggler').addClass("closed")});
	jQuery('a.opener<?php echo $id ?>').click(function(){
		jQuery('div.answer<?php echo $id ?>').slideDown();
		jQuery('.faqtogglerdiv<?php echo $id ?> a.faqtoggler').toggleClass("open");
		jQuery('.faqtogglerdiv<?php echo $id ?> a.faqtoggler').removeClass("closed")});
	jQuery('a.opener<?php echo $id ?>').click(function(){jQuery('div.bottom_controls<?php echo $id ?>').fadeIn();});
	jQuery('a.hide<?php echo $id ?>').click(function(){jQuery('div.bottom_controls<?php echo $id ?>').fadeOut();});
	jQuery('.faqtogglerdiv<?php echo $id ?> a.faqtoggler').click(function(){ jQuery('div.answer<?php echo $id ?>').slideUp(); jQuery('.faqtogglerdiv<?php echo $id ?> a.faqtoggler').removeClass("open"); jQuery('.faqtogglerdiv<?php echo $id ?> a.faqtoggler').addClass("closed"); jQuery(this).parent('div').next('div').slideToggle(); jQuery(this).toggleClass("open"); return false; 
	});
});
</script>

It works well and I wanted to know if you can help me to tweak it even further by allowing a mouse click on an open question to close that specific question.
it should eventually do:
1. one click to open itself.
2. one click to close itself.
3. if other question is open, it will be closed upon opening a new question.

you see, now when i click on a question, it will do a close and open function together.


Thanks.
  • pipo's Avatar
  • pipo
  • Free Extensions
  • 3 posts
  • Karma: 0
The administrator has disabled public write access.
Hi Pipo,

Ill take a look at adding this option when I do the next upgrade for the module - not sure when that will be though.

Thanks Anthony
  • Anthony Olsen's Avatar
  • Anthony Olsen
  • LIfetime Developer - Big Bamboo
  • 23925 posts
  • 788 Thanks
  • Karma: 433
The administrator has disabled public write access.

zentoolsIf you use Zentools please post a review at the Joomla! Extensions Directory.

Happy Campers