Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1429289

    Hi there,

    Would it be possible to add some CSS which defines that for a certain toggle accordeon element all toggles are opened on desktop viewports while the toggles keep nicely collapsed on mobile viewports.

    Currently the toggles are standard closes, wish to open them all standard from a viewpoint of 768 or higher.

    Thanks in advance!

    #1429323

    Hey Enfoldfanatic,

    Thank you for the inquiry.

    Edit the Accordion element and make sure that the Content > Behavior > Behavior is set to Multiple toggles open allowed. You can then add this script in the functions.php file to programmatically open all toggles only on desktop view.

    function av_custom_inline_script()
    {
        wp_add_inline_script( 'jquery', 
        "
        (function($) {
            var windowsize = $(window).width();
    
            if (windowsize > 1024) {
                $(window).on('load', function() { 
                    $('.toggler').trigger('click');
                    $('.toggler').addClass('activeTitle');
                    $('.toggle_wrap').addClass('active_tc');
                });
            }
        })(jQuery);
        "
        );
    }
    add_action( 'wp_enqueue_scripts', 'av_custom_inline_script' );

    Best regards,
    Ismael

    #1429356

    Hi Ismael,

    Works great! Thank for sharing this perfect solution.

    Kind regards

    #1429380

    Hi,

    Great, I’m glad that Ismael could help you out. Please let us know if you should need any further help on the topic, or if we can close it.

    Best regards,
    Rikard

    #1429446

    Hi Rikard,

    Feel free to close the thread.

    Kind Regards
    Enfoldfanatic

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Standard open all accordeon toggles on desktop’ is closed to new replies.