Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro How to stop removal of JS classes on Ajax change?

Viewing 4 posts - 1 through 4 (of 4 total)
  • Christian
    #162466

    Hello,

    I’ve implemented some JS code to the H4 headings of each section within the UI so that you can toggle each one to reveal the different checkbox options (otherwise it would be a really long list).

    On clicking the H4, it adds an open class to the ul that contains the checkbox options, which I can then hook onto in CSS to show the options. However after selecting an option, the refreshing of results via AJAX removes this open class that has been added.

    How do I stop this class from being removed? It seems like on Ajax refresh there is some sort of function that refreshes all of the search and filter UI markup, as well as the results. Alternatively, is there a JF function I can hook into to trigger after this completes?

    Christian
    #162467
    This reply has been marked as private.
    Trevor Moderator
    #162486

    If you turn your code into a function, and call that function on page load, then, use this code also (inserting you function into the commented out line:

    <script>(function ( $ ) {
      "use strict";
      $(document).on("sf:ajaxfinish", ".searchandfilter", function(){
        console.log("ajax complete");
    // load your code function here
      });
    }(jQuery));</script>
    Christian
    #164286

    Thanks Trevor, we’ll give this a go later this week and come back to you if we have any issues.

Viewing 4 posts - 1 through 4 (of 4 total)

The forum ‘Search & Filter Pro’ is closed to new topics and replies.