/*
* jquery-auto-height.js
*
* Copyright (c) 2010 Tomohiro Okuwaki (http://www.tinybeans.net/blog/)
* Licensed under MIT Lisence:
* http://www.opensource.org/licenses/mit-license.php
* http://sourceforge.jp/projects/opensource/wiki/licenses%2FMIT_license
*
* Since: 2010-04-19
* Update: 2015-03-26
* version: 0.05
* Comment:
*
* jQuery 1.2 <-> 1.10.2
*
*/
(function($){
$.fn.autoHeight = function(options){
var op = $.extend({
column : 0,
clear : 0,
height : 'minHeight',
reset : ''
},options || {}); // optionsã«å€¤ãŒã‚れã°ä¸Šæ›¸ãã™ã‚‹
var self = $(this);
if (op.reset === 'reset') {
self.removeAttr('style');
}
// è¦ç´ ã®é«˜ã•ã‚’å–å¾—
var hList = self.map(function(){
return $(this).height();
}).get();
var hListLine = [];
if (op.column > 1) {
for(var i = 0, l = hList.length; i < Math.ceil(l / op.column); i++) {
var x = i * op.column;
// 指定カラム数ã®é…列を切り出ã—ã€ãã®ä¸ã®é«˜ã•ã®æœ€å¤§å€¤ã‚’å–å¾—ã™ã‚‹
hListLine.push(Math.max.apply(null, hList.slice(x, x + op.column)));
}
}
// 高ã•ã®æœ€å¤§å€¤ã‚’è¦ç´ ã«é©ç”¨
var ie6 = typeof window.addEventListener === "undefined" && typeof document.documentElement.style.maxHeight === "undefined";
if (op.column > 1) {
for (var j=0; j