- This topic has 2 replies, 2 voices, and was last updated 9 years, 1 month ago by .
Viewing 3 posts – 1 through 3 (of 3 total)
Viewing 3 posts – 1 through 3 (of 3 total)
Forums › Forums › Search & Filter Pro › Detect Ajax call
Tagged: ajax
Hey,
We’re integrating Photoswipe with Search/Filter Pro. However Photoswipe only knows about the elements in the DOM on page load and does not know when new items get added (through ajax). Is there a hook we could use to tell Photoswipe to rebuild its index when Search/Filter Pro has an successful ajax request?
Thanks, Adam
Indeed there is. Replace the comment in this code with whatever Photoswipe needs to do:
<script>(function ( $ ) {
"use strict";
$(document).on("sf:ajaxfinish", ".searchandfilter", function(){
console.log("ajax complete");
// load your Photoswipe javascript here
});
}(jQuery));</script>