Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1035794

    Hi,

    We have created on this page 6 accordions in a single color section : https://kiffetonchantier.com/home/
    Each accordion is in a single column on the back office of Enfold (Avia formatting tool).

    When we open an accordion on the front office of this page, we would like that others close automatically.

    Indeed, it’s not the case wheras we have checked “Only one panel can be open at a time (accordion)” for each accordion on Avia formatting tool.

    Can you please explain us how to fix it ?

    Thanks a lot for your answer,

    Best Regards,

    A&M Concept Team from France

    #1036607

    Hey AMconcept,

    You can only have that functionality in an accordion if it’s in one accordion but if it’s separate, it won’t work since it doesn’t check for other accordions outside.
    Though what you want to achieve is still possible using some javascript/jquery code. Can you give us temporary admin access? so we can try to add this then post what we have changed.
    Just post the credentials in private content so it’s only visible to the moderators.

    Best regards,
    Nikko

    #1036972

    Hi Nikko,

    Thanks a lot for your answer ! You’ll find our credentials in private content, many thanks in advance for your help !

    Best regards,

    A&M Concept Team from France

    #1038044

    Hi,

    Thanks for giving us both admin and ftp access.
    I have added this in the Developer ID of your section (wrapping the toggle) accordion-section
    Then in your functions.php, I have added this php code (at the bottom):

    function accordion_fn(){
    	?>
    	<script>
    	$( document ).ready(function() {
    		
    		$( "#accordion-section .single_toggle .toggler" ).on("click", function() {
    			var $el = $( "#accordion-section" ),
    					fake_id = $(this).data("fake-id") + "-container",
    					$id = $( fake_id ).attr('id');
    			
    			$el.find(".toggle_wrap").each(function(){
    					var temp_id = "#" + $(this).attr('id');
    					if( !( temp_id == fake_id ) ) {
    						$(this).removeClass("active_tc");
    					}
    			});
    			
    		});
    	});
    	</script>
    	<?php
    }
    add_action('wp_footer', 'accordion_fn');

    However during theme update this tweak would be lost so I would suggest using a child theme: https://kriesi.at/documentation/enfold/how-to-install-enfold-theme/#why-child-theme
    Then remove the code I added in the functions.php of the parent theme and put it in the functions.php of your child theme.
    Hope this helps.

    Best regards,
    Nikko

    #1038674

    Hi Nikko,

    Thanks a lot for your help, that’s perfect !

    Have a nice continuation,

    Best regards,

    A&M Concept Team from France

    #1038686

    Hi,

    I’m glad this was resolved. If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Automatically close accordions on a single color section’ is closed to new replies.