1/** 2 * Component equalHeight 3 * makes the same height of content that 'equal' class or for flip sides 4 * @module equalHeight 5 * @param {jQuery} $ Instance of jQuery 6 * @return {Object} List of equalHeight methods 7 */ 8XA.component.equalHeight = (function ($) { 9 /** 10 * List of selectors for calculating height functionality 11 * @type {Object.<Methods>} 12 * @memberOf module:equalHeight 13 * */ 14 var settings = { 15 parentSelector: '.equalized-content', 16 selector: '.equal:not(.flip.component),.flip .Side0,.flip .Side1' 17 }; 18 /** 19 * This object stores all public api methods 20 * @type {Object.<Methods>} 21 * @memberOf module:equalHeight 22 * */ 23 var api = {}; 24 /** 25 * fixHeight method calculates height of bigger element 26 * and sets up the same size for other elements 27 * @memberOf module:equalHeight 28 * @alias module:equalHeight.fixHeight 29 */ 30 api.fixHeight = function () { 31 32 $(settings.parentSelector).each(function () { 33 var $elements = $(this).find(settings.selector), 34 maxHeight = 0; 35 36 37 38 $elements.each(function () { 39 var $element = $(this); 40 $element.css('min-height', 'inherit'); 41 $element.find('>.component-content').css('min-height', 'inherit'); 42 43 if ($element.outerHeight(true) > maxHeight) { 44 maxHeight = $element.outerHeight(true); 45 } 46 }); 47 48 if (maxHeight > 0) { 49 $elements.each(function () { 50 var $element = $(this); 51 if ($element.hasClass("Side0") || $element.hasClass("Side1")) { 52 $element.parent().attr('class', 'flip').css({ 'min-height': maxHeight }); 53 } 54 $element.css({ 55 'min-height': maxHeight 56 }); 57 $element.find('>.component-content').css({ 58 'min-height': maxHeight 59 }); 60 }); 61 } 62 }); 63 } 64 /** 65 * init method binds call of 66 * ["fixHeight"]{@link module:equalHeight.fixHeight} method 67 * for window load and resize events 68 * @memberOf module:equalHeight 69 * @alias module:equalHeight.init 70 */ 71 api.init = function () { 72 $(window).bind('load', function () { 73 setTimeout(api.fixHeight, 0); 74 }); 75 76 $(window).bind('resize', function () { 77 api.fixHeight(); 78 }); 79 }; 80 81 return api; 82 83}(jQuery, document)); 84 85XA.register("equalHeight", XA.component.equalHeight);
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.