Forums › Forums › Search & Filter Pro › Trying to implement with animations and masonry
- This topic has 13 replies, 4 voices, and was last updated 8 years, 4 months ago by Anonymous.
-
Ross Moderator(Private) June 28, 2016 at 5:40 pm #49672
Ah is that the contents of your JS file exactly? Then you probably just need to wrap it in a function call or ready event, I would do it like:
(function ( $ ) { "use strict"; $(function () { $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ console.log("ajax complete"); //so load your lightbox or JS scripts here again }); }); }(jQuery));
Let me know how you get on.
Thanks
Ross Moderator(Private) June 30, 2016 at 11:47 pm #49957So your current JS file looks like this as you mention:
//detects the start of an ajax request being made $(document).on("sf:ajaxstart", ".searchandfilter", function(){ console.log("ajax start"); }); //detects when the ajax request has finished and the content has been updated // - add scripts that apply to your results here $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ console.log("ajax complete"); //so load your lightbox or JS scripts here again }); //an event fired when S&F is initialised and S&F scripts have been loaded $(document).on("sf:init", ".searchandfilter", function(){ console.log("S&F JS initialised"); });
Replace that with:
(function ( $ ) { "use strict"; $(function () { //detects the start of an ajax request being made $(document).on("sf:ajaxstart", ".searchandfilter", function(){ console.log("ajax start"); }); //detects when the ajax request has finished and the content has been updated // - add scripts that apply to your results here $(document).on("sf:ajaxfinish", ".searchandfilter", function(){ console.log("ajax complete"); //so load your lightbox or JS scripts here again }); //an event fired when S&F is initialised and S&F scripts have been loaded $(document).on("sf:init", ".searchandfilter", function(){ console.log("S&F JS initialised"); }); }); }(jQuery));
You can see the same code exists, but just wrapped in a function.. 🙂
Anonymous(Private) August 12, 2016 at 6:00 pm #54443Finally got this working!
console.log(“ajax complete”);
$(‘#ms-container’).imagesLoaded( function() {
var container = document.querySelector(‘#ms-container’);
var msnry = new Masonry( container, {
itemSelector: ‘.ms-item’,
columnWidth: ‘.ms-item’,
isAnimated: true,
});
});});
Thank you for all your help!!
-
AuthorPosts