Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1483495

    Hello,
    I have a page with 3 different accordion, each one with an #id.
    Actually when I click on each accordion block the clicked section open and the rest close.
    I would like to know if this behaviour can be used on the other accordion blocks. So just one exploded section is big in the whole page.

    Thanks for support

    #1483529

    Hey SurigliaStudio,

    I’m not sure that I understand your question, do you want to open multiple tabs with one click?

    Best regards,
    Rikard

    #1483538

    can you show me the page – it is hard to find the right selectors without the example page.

    #1483613

    Hello, this is the page.
    As you can see there are 5 different accordion.
    If you click on “PERCORSI” on the “FOOD” accordion it open.
    Later on if you click on “CALICE” it open the other accordion and the “PERCORSI” one stay open.
    I would like to know if there is a way to make the other accordion close on click on a different one, so I always have a single accordion section open at a time.

    #1483615

    put this to your child-theme functions.php:

    function only_one_toggle_open_at_the_same_time(){
    ?>
    <script>
    window.addEventListener("DOMContentLoaded", function () { 
    (function($){
        $('.toggler').on('click', function(){
            $('.toggler').not(this).next('.toggle_wrap').removeClass('active_tc');
            $('.toggler').not(this).removeClass('activeTitle'); 
        }); 
    })(jQuery);
    });
    </script>
    <?php
    }
    add_action('wp_footer', 'only_one_toggle_open_at_the_same_time');

    if you like to have that only for that page – use conditional tags – and insert instead:

    function only_one_toggle_open_at_the_same_time(){
    if ( is_page(719) ) {
    ?>
    <script>
    window.addEventListener("DOMContentLoaded", function () { 
    (function($){
        $('.toggler').on('click', function(){
            $('.toggler').not(this).next('.toggle_wrap').removeClass('active_tc');
            $('.toggler').not(this).removeClass('activeTitle'); 
        }); 
    })(jQuery);
    });
    </script>
    <?php
    }
    }
    add_action('wp_footer', 'only_one_toggle_open_at_the_same_time');
    #1483632

    Hi,

    Thanks for helping out @guenni007 :-)

    Best regards,
    Rikard

    #1483862

    Hey Guenni, thanks for your awesome help, as always :)
    Have a nice day.
    A

    #1483876

    But you do not use it now?

    #1483877

    I do, just didn’t clean the cache. Now you should see it correctly :)

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.