Forked from steveosoule/miva-searchspring-after-results-change.js
Last active
August 29, 2015 14:25
-
-
Save tessguefen/a5a7349c60225842da99 to your computer and use it in GitHub Desktop.
Search Spring - After Result Change Psuedo Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
afterResultsChange: function() { | |
$(document).trigger('SearchSpring_AfterResultsChange'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment