Skip to content

Instantly share code, notes, and snippets.

@bmsterling
Created May 3, 2011 12:49
Show Gist options
  • Save bmsterling/953269 to your computer and use it in GitHub Desktop.
Save bmsterling/953269 to your computer and use it in GitHub Desktop.
Conversion of the jQuery Equal height plugin for Dojo 1.3.2 (not sure if it works in newer versions)
(function(d){
dojo.extend(dojo.NodeList, {
equalHeight: function(options, data){
var defaults = {
height:null,
minHeight: 0,
maxHeight: null
};
options = dojo.mixin(defaults, options);
if(options.height !== null){
//if specific height is set
this.style('height',options.height+'px');
}
else{
this.style('height','auto');
var coords = this.coords();
this.forEach(
function( node, index, array ){
if( coords[ index ].h > options.minHeight ){
options.minHeight = coords[ index ].h;
}
if(options.maxHeight !== null){
if(options.minHeight > options.maxHeight){
options.minHeight= options.maxHeight;
}
}
}
);
this.style('height',options.minHeight+'px');
}
return this; // dojo.NodeList
}
});
})(dojo);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment