1// heightmatch.js is to match one boxes height to another boxes height. 2// this will only make boxes bigger, not smaller. 3// 4// requires jquery of course 5// 6// you can then adjust for any offset necessary (add some pixels to box1 or box2) 7// use window.load instead of document.ready to make sure everything is loaded and the sizes are set 8// <script> 9// $(window).on('load', function(){ 10// Match.heightMatch('.leftColumn .graybox', '.centerColumn .graybox', 0, 42); 11// }); 12// </script> 13// 14 15var Match = new (function Match() { 16 this.heightMatch = function heightMatch(box1, box2, box1Adjust, box2Adjust) { 17 if($(box1).height() > $(box2).height()) 18 $(box2).height($(box1).height()); 19 else if($(box2).height() > $(box1).height()) 20 $(box1).height($(box2).height()); 21 if(box1Adjust > 0) 22 $(box1).height($(box1).height() + box1Adjust); 23 if(box2Adjust > 0) 24 $(box2).height($(box2).height() + box2Adjust); 25 } 26 27 this.heightMatch3 = function heightMatch3(box1, box2, box3, box1Adjust, box2Adjust, box3Adjust) { 28 var a = $(box1).height() 29 var b = $(box2).height() 30 var c = $(box3).height() 31 32 if(a > b && a > c){ 33 $(box2).height(a); 34 $(box3).height(a); 35 } 36 else if (b > a && b > c){ 37 $(box1).height(b); 38 $(box3).height(b); 39 } 40 else if (c > a && c > b){ 41 $(box1).height(c); 42 $(box2).height(c); 43 } 44 45 if(box1Adjust > 0) 46 $(box1).height($(box1).height() + box1Adjust); 47 if(box2Adjust > 0) 48 $(box2).height($(box2).height() + box2Adjust); 49 if(box3Adjust > 0) 50 $(box3).height($(box3).height() + box3Adjust); 51 } 52 53 this.classMatch = function classMatch(className) { 54 var h = 0; 55 var n = false; 56 $(className).each(function () { 57 if ($(this).css('display') == 'none') { 58 n = true; 59 $(this).css('display', 'block'); 60 } 61 if ($(this).height() > h) { 62 h = $(this).height(); 63 } 64 if (n == true) { 65 $(this).css('display', ''); 66 n = false; 67 } 68 }); 69 if (h > 0) { 70 $(className).height(h); 71 } 72 } 73 74 this.classMatch2 = function classMatch(className) { 75 var h = 0; 76 var n = ''; 77 $(className).each(function () { 78 n = $(this).css('display'); 79 $(this).css('display', 'block'); 80 if ($(this).height() > h) { 81 h = $(this).height(); 82 } 83 $(this).css('display', n); 84 }); 85 if (h > 0) { 86 $(className).height(h); 87 } 88 } 89 90 91})();
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.