Created
May 3, 2011 12:49
-
-
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)
This file contains hidden or 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
(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