// Generated by CoffeeScript 1.7.1 /* eqHeight.coffee v1.3.5 http://jsliang.github.com/eqHeight.coffee Copyright (c) 2013-2014, Jui-Shan Liang All rights reserved. Licensed under GPL v2. */ var $; $ = jQuery; $.fn.extend({ eqHeight: function(column_selector, option) { if (option == null) { option = { equalize_interval: null, break_point: null }; } return this.each(function() { var columns, equalizer, infinite_equalizing, start_equalizing, timer, _equalize_marked_columns; timer = null; columns = $(this).find(column_selector); if (columns.length === 0) { columns = $(this).children(); } if (columns.length === 0) { return; } _equalize_marked_columns = function() { var marked_columns, max_col_height; marked_columns = $(".eqHeight_row"); max_col_height = 0; marked_columns.each(function() { return max_col_height = Math.max($(this).outerHeight(), max_col_height); }); marked_columns.height(max_col_height); return $(".eqHeight_row").removeClass("eqHeight_row"); }; equalizer = function() { var row_top_value; columns.height("auto"); if (typeof option.break_point === "number" && $(window).width() <= option.break_point) { return; } row_top_value = columns.first().position().top; columns.each(function() { var current_top; current_top = $(this).position().top; if (current_top !== row_top_value) { _equalize_marked_columns(); row_top_value = $(this).position().top; } return $(this).addClass("eqHeight_row"); }); return _equalize_marked_columns(); }; start_equalizing = function() { clearTimeout(timer); return timer = setTimeout(equalizer, 100); }; infinite_equalizing = function() { equalizer(); return timer = setTimeout(infinite_equalizing, option.equalize_interval); }; $(window).load(equalizer); if (typeof option.equalize_interval === "number") { return infinite_equalizing(); } else { return $(window).resize(start_equalizing); } }); } });