0
因爲我可以改變函數的高度(equalHeights),但可以調整大小。調整高度(equalHeights)jQuery
JQUERY:
$.fn.equalHeights = function() {
var maxHeight = 0;
// get the maximum height
this.each(function() {
var $this = $(this);
if ($this.height() > maxHeight) {
maxHeight = $this.height();
}
});
// set the elements height
this.each(function() {
var $this = $(this);
$this.height(maxHeight);
});
};
RESIZE:
$(window).load(function() {
$(window).resize(function() {
$("#layout .item").not("#layout .item.custom").find("img").equalHeights();
});
});
例:http://jsfiddle.net/u8e1ju9b/1/