Hello,
on my website I have the following script running (it is needed on some of the pages where I want to have all accordions expanded on page load, not on all pages):
function add_custom_script(){
?>
<script>
jQuery(window).load(function(){
jQuery("p.toggler").trigger('click');
});
</script>
<?php
}
add_action('wp_footer', 'add_custom_script');
in combination with the accordion setting “Multiple toggles open allowed”, like it is suggested here:
But I also have a page to which one comes with the link http://www.privatedata.com/somepagetitle#toggle-id-3 , so that the accordion #3 should be directly displayed expanded and others should stay closed. The above script unfortunately closes this accordion #3 as soon as the page gets loaded. How to adjust the script?
Best regards
Hey med,
Try adjusting the script like this:
function add_custom_script(){
if (is_page(5832)) { return; }
?>
<script>
jQuery(window).load(function(){
jQuery("p.toggler").trigger('click');
});
</script>
<?php
}
add_action('wp_footer', 'add_custom_script');
If you need further assistance please let us know.
Best regards,
Victoria
Thank you Victoria x
Hi med,
Glad that Victoria helped you. :)
Let us know if you need further assistance or if we can close this thread.
Best regards,
Nikko