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!
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
Hi Ismael,
Works great! Thank for sharing this perfect solution.
Kind regards
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
Hi Rikard,
Feel free to close the thread.
Kind Regards
Enfoldfanatic