Tagged: Accordion, ajax, custom search, toggles, Toolset
-
AuthorPosts
-
June 22, 2019 at 8:07 pm #1112606
Hi, i am building a custom search with toolset.
I use the Enfold Accordion for the results (not with shortcodes).This is my loop:
<section class="av_toggle_section" itemscope="itemscope" itemtype="https://schema.org/CreativeWork"> <div class="single_toggle" data-tags="{Alle} "> <p data-fake-id="#toggle-id-[tssnippet-loop-iteration]" class="toggler " itemprop="headline">[wpv-post-title]<span class="toggle_icon"> <span class="vert_icon"></span><span class="hor_icon"></span></span></p> <div id="toggle-id-[tssnippet-loop-iteration]-container" class="toggle_wrap" style="display: block;"><div class="toggle_content invers-color " itemprop="text"> <h3>[wpv-post-link]</h3> <p class="seminarkurztext">[wpv-post-excerpt]</p></br> <p><strong>Seminar-Art:</strong> [wpv-post-taxonomy type="seminar-arten" format="name"]</p> <p><strong>Kategorien:</strong> <span class="seminarkategorien">[wpv-post-taxonomy type="seminar-kategorie" format="name"]</span></p> [wpv-conditional if="( $(price) ne '' )"]<p><strong>Teilnahmegebühr:</strong> <span class="seminarpreis">[types field="price"][/types] €</span>[/wpv-conditional]</div></div> </div></section>
it is working really good. But when i do an Ajax-Search on this loop, the results – Toggles won’t open when clicked. They do nothing.
There is no Error in the console, the syntax of the source is also absolutely correct. When i reload the page, the toggles work like expected. I guess there is a compiling of the toggles? I worked on it the whole day … I could not figure it out.
Any idea how i can solve this, without renouncing Ajax functionality?
June 25, 2019 at 1:07 am #1113035Hey madsonic,
Thank you for using Enfold.
You have to re-initialize the toggles after the AJAX request or after the toggler in the search results load.
//activates the toggle shortcode if($.fn.avia_sc_toggle) { $('.togglecontainer', container).avia_sc_toggle(); }
Just add that inside the complete or success AJAX callback.
Best regards,
IsmaelJune 28, 2019 at 10:06 am #1114183Thank you Ismael, great Support. I had to modify it a little bit, this did the trick:
jQuery( document ).on( 'js_event_wpv_parametric_search_results_updated', function( event, data ) { jQuery('.togglecontainer').avia_sc_toggle(); });
Have a nice day!
June 29, 2019 at 2:02 pm #1114423Hi madsonic,
Glad you got it working for you! :)
If you need further assistance please let us know.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.