Skip to content

Instantly share code, notes, and snippets.

@yoko
Created September 29, 2011 09:15
Show Gist options
  • Save yoko/1250370 to your computer and use it in GitHub Desktop.
Save yoko/1250370 to your computer and use it in GitHub Desktop.
$.fn.boxHeight = function() {
var target = [],
top = 0,
height = 0;
this.each(function() {
var self = $(this);
if (self.position().top != top) {
target.length > 1 && $(target).height(height);
target = [];
height = 0;
top = self.position().top;
}
target.push(this);
height = Math.max(self.height(), height);
});
target.length > 1 && $(target).height(height);
return this;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment