I want to add a new option to the equal height plugin that allows the height to be calculated after a time delay. Reason being that I have other jquery script which managed a image gallery that changes in height.
$.fn.extend({
equalHeight: function (options) {
//set default height to 0 or auto
var defaults = {
height:null,
minHeight: 0,
maxHeight: null
};
//merge options
options = $.extend(defaults, options);
//cache the children (is this the parent or a group of elements)
var children = (this.length > 1) ? this : this.children();
if(options.height !== null){
//if specific height is set
children.height(options.height);
}else{
//set the height to auto which releases the boxes heights
children.css('height', 'auto');
//loop though the elements and get their heights
children.each(function () {
//if bigger than the default set to default
if ($(this).height() > options.minHeight) options.minHeight= $(this).height();
//if maxheight is set
if(options.maxHeight !== null){
if(options.minHeight > options.maxHeight) options.minHeight= options.maxHeight;
}
});
//set the height on all the children
children.height(options.minHeight);
}
//return this so the jQuery chain is preserved
return this;
}
});
May be you should use setInterval(100):
Or if you can catch image resize event use global variable to ensure that image resized and setInterval
— Update
You can try this:
Use following to run with delay