Sha256: ec57b6b8bb4ca5cc6d8927f30e5f42ddffd940315ceda89353a79ba315158be4

Contents?: true

Size: 1.69 KB

Versions: 40

Compression:

Stored size: 1.69 KB

Contents

;(function ($, window, document, undefined) {
  'use strict';

  Foundation.libs.equalizer = {
    name : 'equalizer',

    version : '5.1.1',

    settings : {
      use_tallest: true,
      before_height_change: $.noop,
      after_height_change: $.noop
    },

    init : function (scope, method, options) {
      this.bindings(method, options);
      this.reflow();
    },

    events : function () {
      this.S(window).off('.equalizer').on('resize.fndtn.equalizer', function(e){
        this.reflow();
      }.bind(this));
    },

    equalize: function(equalizer) {
      var isStacked = false,
          vals = equalizer.find('[' + this.attr_name() + '-watch]'),
          firstTopOffset = vals.first().offset().top,
          settings = equalizer.data(this.attr_name(true)+'-init');
      
      if (vals.length === 0) return;
      settings.before_height_change();
      equalizer.trigger('before-height-change');
      vals.height('inherit');
      vals.each(function(){
        var el = $(this);
        if (el.offset().top !== firstTopOffset) {
          isStacked = true;
        }
      });
      if (isStacked) return;
      
      var heights = vals.map(function(){ return $(this).outerHeight() });
      if (settings.use_tallest) {
        var max = Math.max.apply(null, heights);
        vals.height(max);
      } else {
        var min = Math.min.apply(null, heights);
        vals.height(min);
      }
      settings.after_height_change();
      equalizer.trigger('after-height-change');
    },

    reflow : function () {
      var self = this;

      this.S('[' + this.attr_name() + ']', this.scope).each(function(){
        self.equalize($(this));
      });
    }
  };
}(jQuery, this, this.document));

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
opsask-2.3.10 public/js/foundation/foundation.equalizer.js
opsask-2.3.9 public/js/foundation/foundation.equalizer.js
opsask-2.3.8 public/js/foundation/foundation.equalizer.js
opsask-2.3.7 public/js/foundation/foundation.equalizer.js
opsask-2.3.6 public/js/foundation/foundation.equalizer.js
opsask-2.3.5 public/js/foundation/foundation.equalizer.js
opsask-2.3.4 public/js/foundation/foundation.equalizer.js
opsask-2.3.3 public/js/foundation/foundation.equalizer.js
opsask-2.3.2 public/js/foundation/foundation.equalizer.js
opsask-2.3.1 public/js/foundation/foundation.equalizer.js
opsask-2.3.0 public/js/foundation/foundation.equalizer.js
opsask-2.2.3 public/js/foundation/foundation.equalizer.js
opsask-2.2.2 public/js/foundation/foundation.equalizer.js
opsask-2.2.1 public/js/foundation/foundation.equalizer.js
opsask-2.2.0 public/js/foundation/foundation.equalizer.js
opsask-2.1.9 public/js/foundation/foundation.equalizer.js
opsask-2.1.8 public/js/foundation/foundation.equalizer.js
opsask-2.1.7 public/js/foundation/foundation.equalizer.js
opsask-2.1.6 public/js/foundation/foundation.equalizer.js
opsask-2.1.5 public/js/foundation/foundation.equalizer.js