On this page hidden link we have created a WooCommerce product catalog (Toolset View) that is supposed to be filterable, which works well in the meantime. Now, the individual filters should be expanded and collapsed by clicking on the name of the respective filter, which also works well in itself - at least until the filters were triggered. Then all toggles open and cannot be closed anymore.
For the toggles we used the following function: hidden link
What did we do wrong that the toggle containers do not open after clicking and cannot be closed again?
Can you help?
Hello and thank you for contacting the Toolset support.
When the page loads for the first time, the Javascript code to enable toggle is run. But, when results are loaded again using AJAX, the filter are also loaded again, and the toggle Javascript code needs to run again.
Because the view uses AJAX to load the results, you need to run the custom Javascript for the Toggle shortcode after reloading results too.
Try the following Javascript code instead of the original one, this way, it will be run when the page first loads(ready event) and after the search results are loaded using AJAX(js_event_wpv_parametric_search_results_updated event):
jQuery( function( $ ) {
$( document ).on('ready js_event_wpv_parametric_search_results_updated', function() {
$( ".toggle_container" ).hide();
$( "h3.toggle-trigger" ).click( function() {
$(this).toggleClass( "active" ).next().slideToggle( "normal" );
return false;
} );
} );
} );
If this does not help, please allow me temporary access to your website and let me check the view closely.
I hope this helps. Let me know if you have any questions.