1/* 2 * jquery-auto-height.js 3 * 4 * Copyright (c) 2010 Tomohiro Okuwaki (http://www.tinybeans.net/blog/) 5 * Licensed under MIT Lisence: 6 * http://www.opensource.org/licenses/mit-license.php 7 * http://sourceforge.jp/projects/opensource/wiki/licenses%2FMIT_license 8 * 9 * Since: 2010-04-19 10 * Update: 2013-08-16 11 * version: 0.04 12 * Comment: 13 * 14 * jQuery 1.2 <-> 1.10.2 15 * 16 */ 17 18 (function($){ 19 $.fn.autoHeight = function(options){ 20 var op = $.extend({ 21 22 column : 0, 23 clear : 0, 24 height : 'minHeight', 25 reset : '', 26 descend : function descend (a,b){ return b-a; } 27 28 },options || {}); // optionsã«å¤ãããã°ä¸æ¸ããã 29 30 var self = $(this); 31 var n = 0, 32 hMax, 33 hList = new Array(), 34 hListLine = new Array(); 35 hListLine[n] = 0; 36 37 // è¦ç´ ã®é«ããåå¾ 38 self.each(function(i){ 39 if (op.reset == 'reset') { 40 $(this).removeAttr('style'); 41 } 42 var h = $(this).height(); 43 hList[i] = h; 44 if (op.column > 1) { 45 // op.columnãã¨ã®æå¤§å¤ãæ ¼ç´ãã¦ãã 46 if (h > hListLine[n]) { 47 hListLine[n] = h; 48 } 49 if ( (i > 0) && (((i+1) % op.column) == 0) ) { 50 n++; 51 hListLine[n] = 0; 52 }; 53 } 54 }); 55 56 // åå¾ããé«ãã®æ°å¤ãéé ã«ä¸¦ã¹æ¿ã 57 hList = hList.sort(op.descend); 58 hMax = hList[0]; 59 60 // é«ãã®æå¤§å¤ãè¦ç´ ã«é©ç¨ 61 var ie6 = typeof window.addEventListener == "undefined" && typeof document.documentElement.style.maxHeight == "undefined"; 62 if (op.column > 1) { 63 for (var j=0; j<hListLine.length; j++) { 64 for (var k=0; k<op.column; k++) { 65 if (ie6) { 66 self.eq(j*op.column+k).height(hListLine[j]); 67 } else { 68 self.eq(j*op.column+k).css(op.height,hListLine[j]); 69 } 70 if (k == 0 && op.clear != 0) { 71 self.eq(j*op.column+k).css('clear','both'); 72 } 73 } 74 } 75 } else { 76 if (ie6) { 77 self.height(hMax); 78 } else { 79 self.css(op.height,hMax); 80 } 81 } 82 }; 83})(jQuery); 84
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.