Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save tessguefen/a5a7349c60225842da99 to your computer and use it in GitHub Desktop.
Save tessguefen/a5a7349c60225842da99 to your computer and use it in GitHub Desktop.
Search Spring - After Result Change Psuedo Example
$(document).on('SearchSpring_AfterResultsChange', function(){
// console.log('SearchSpring_AfterResultsChange');
conformResults.init();
$('.product-tile--grid').find('img').on('load', function(){
// console.log('image loaded');
conformResults.init()
});
});
$( window ).on( 'resize', conformResults.init );
var conformResults = {
id: 0,
init: function(){
var _self = this;
window.clearTimeout( _self.id );
_self.id = setTimeout(function(){
conformResults.conform('.product-tile--grid .product-tile');
}, 500);
},
conform: function(selector) {
var maxHeight = 0;
$(selector).removeAttr("style").each(function() {
var $this = $(this);
if ( $this.outerHeight() > maxHeight ) {
maxHeight = $this.outerHeight();
}
}).css("height", maxHeight + "px");
return this;
}
};
afterResultsChange: function() {
$(document).trigger('SearchSpring_AfterResultsChange');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment