Forums › Forums › Search & Filter Pro › Ajax Hook – Complete
- This topic has 10 replies, 3 voices, and was last updated 8 years, 6 months ago by
Ross.
-
Trevor(Private) April 24, 2017 at 10:49 am #104437
You will likely need to wrap it in a function for WordPress to use, like this:
(function ( $ ) { "use strict"; $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ console.log("ajax complete"); //so load your lightbox or JS scripts here again }); }(jQuery));Ross Moderator(Private) April 27, 2017 at 1:24 am #105129Hi Corné
I just did a test locally and no issue.
Had a look at your site and nothing sticks out.
What I think *could* be happening is that some other Javascript in your theme or another plugin, could be removing the event handlers from
document, which means our events do not get picked up at all.A couple of things to test:
1) After
"use strict";add aconsole.log("test");, just to make sure the script is loading – this way you’ll see “test” in the console on page load – final code would look like:(function ( $ ) { "use strict"; console.log("test") $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ console.log("ajax complete"); //so load your lightbox or JS scripts here again }); }(jQuery));2) Test S&F on a clean install, and test this code. I’ve just tested with 2015 and 2016 themes, and the events are fired just fine.
Hope that helps.
Thanks
-
AuthorPosts