foundation.equalizer.js 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory(require("./foundation.core"), require("./foundation.util.imageLoader"), require("./foundation.util.mediaQuery"), require("jquery"));
  4. else if(typeof define === 'function' && define.amd)
  5. define(["./foundation.core", "./foundation.util.imageLoader", "./foundation.util.mediaQuery", "jquery"], factory);
  6. else if(typeof exports === 'object')
  7. exports["foundation.equalizer"] = factory(require("./foundation.core"), require("./foundation.util.imageLoader"), require("./foundation.util.mediaQuery"), require("jquery"));
  8. else
  9. root["__FOUNDATION_EXTERNAL__"] = root["__FOUNDATION_EXTERNAL__"] || {}, root["__FOUNDATION_EXTERNAL__"]["foundation.equalizer"] = factory(root["__FOUNDATION_EXTERNAL__"]["foundation.core"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.imageLoader"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.mediaQuery"], root["jQuery"]);
  10. })(window, function(__WEBPACK_EXTERNAL_MODULE__foundation_core__, __WEBPACK_EXTERNAL_MODULE__foundation_util_imageLoader__, __WEBPACK_EXTERNAL_MODULE__foundation_util_mediaQuery__, __WEBPACK_EXTERNAL_MODULE_jquery__) {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/ }
  51. /******/ };
  52. /******/
  53. /******/ // define __esModule on exports
  54. /******/ __webpack_require__.r = function(exports) {
  55. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/ }
  58. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/ };
  60. /******/
  61. /******/ // create a fake namespace object
  62. /******/ // mode & 1: value is a module id, require it
  63. /******/ // mode & 2: merge all properties of value into the ns
  64. /******/ // mode & 4: return value when already ns object
  65. /******/ // mode & 8|1: behave like require
  66. /******/ __webpack_require__.t = function(value, mode) {
  67. /******/ if(mode & 1) value = __webpack_require__(value);
  68. /******/ if(mode & 8) return value;
  69. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/ var ns = Object.create(null);
  71. /******/ __webpack_require__.r(ns);
  72. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/ return ns;
  75. /******/ };
  76. /******/
  77. /******/ // getDefaultExport function for compatibility with non-harmony modules
  78. /******/ __webpack_require__.n = function(module) {
  79. /******/ var getter = module && module.__esModule ?
  80. /******/ function getDefault() { return module['default']; } :
  81. /******/ function getModuleExports() { return module; };
  82. /******/ __webpack_require__.d(getter, 'a', getter);
  83. /******/ return getter;
  84. /******/ };
  85. /******/
  86. /******/ // Object.prototype.hasOwnProperty.call
  87. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/ // __webpack_public_path__
  90. /******/ __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/ // Load entry module and return exports
  94. /******/ return __webpack_require__(__webpack_require__.s = 6);
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98. /***/ "./foundation.core":
  99. /*!****************************************************************************************************************************************************************!*\
  100. !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.core"],"amd":"./foundation.core","commonjs":"./foundation.core","commonjs2":"./foundation.core"} ***!
  101. \****************************************************************************************************************************************************************/
  102. /*! no static exports found */
  103. /***/ (function(module, exports) {
  104. module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_core__;
  105. /***/ }),
  106. /***/ "./foundation.util.imageLoader":
  107. /*!****************************************************************************************************************************************************************************************************************!*\
  108. !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.imageLoader"],"amd":"./foundation.util.imageLoader","commonjs":"./foundation.util.imageLoader","commonjs2":"./foundation.util.imageLoader"} ***!
  109. \****************************************************************************************************************************************************************************************************************/
  110. /*! no static exports found */
  111. /***/ (function(module, exports) {
  112. module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_imageLoader__;
  113. /***/ }),
  114. /***/ "./foundation.util.mediaQuery":
  115. /*!************************************************************************************************************************************************************************************************************!*\
  116. !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.mediaQuery"],"amd":"./foundation.util.mediaQuery","commonjs":"./foundation.util.mediaQuery","commonjs2":"./foundation.util.mediaQuery"} ***!
  117. \************************************************************************************************************************************************************************************************************/
  118. /*! no static exports found */
  119. /***/ (function(module, exports) {
  120. module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_mediaQuery__;
  121. /***/ }),
  122. /***/ "./js/entries/plugins/foundation.equalizer.js":
  123. /*!****************************************************!*\
  124. !*** ./js/entries/plugins/foundation.equalizer.js ***!
  125. \****************************************************/
  126. /*! exports provided: Foundation, Equalizer */
  127. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  128. "use strict";
  129. __webpack_require__.r(__webpack_exports__);
  130. /* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./foundation.core */ "./foundation.core");
  131. /* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_foundation_core__WEBPACK_IMPORTED_MODULE_0__);
  132. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Foundation", function() { return _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"]; });
  133. /* harmony import */ var _foundation_equalizer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../foundation.equalizer */ "./js/foundation.equalizer.js");
  134. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Equalizer", function() { return _foundation_equalizer__WEBPACK_IMPORTED_MODULE_1__["Equalizer"]; });
  135. _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"].plugin(_foundation_equalizer__WEBPACK_IMPORTED_MODULE_1__["Equalizer"], 'Equalizer');
  136. /***/ }),
  137. /***/ "./js/foundation.equalizer.js":
  138. /*!************************************!*\
  139. !*** ./js/foundation.equalizer.js ***!
  140. \************************************/
  141. /*! exports provided: Equalizer */
  142. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  143. "use strict";
  144. __webpack_require__.r(__webpack_exports__);
  145. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Equalizer", function() { return Equalizer; });
  146. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
  147. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  148. /* harmony import */ var _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation.util.mediaQuery */ "./foundation.util.mediaQuery");
  149. /* harmony import */ var _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1__);
  150. /* harmony import */ var _foundation_util_imageLoader__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation.util.imageLoader */ "./foundation.util.imageLoader");
  151. /* harmony import */ var _foundation_util_imageLoader__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_imageLoader__WEBPACK_IMPORTED_MODULE_2__);
  152. /* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./foundation.core.utils */ "./foundation.core");
  153. /* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__);
  154. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  155. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  156. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  157. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  158. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  159. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  160. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  161. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  162. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  163. /**
  164. * Equalizer module.
  165. * @module foundation.equalizer
  166. * @requires foundation.util.mediaQuery
  167. * @requires foundation.util.imageLoader if equalizer contains images
  168. */
  169. var Equalizer =
  170. /*#__PURE__*/
  171. function (_Plugin) {
  172. _inherits(Equalizer, _Plugin);
  173. function Equalizer() {
  174. _classCallCheck(this, Equalizer);
  175. return _possibleConstructorReturn(this, _getPrototypeOf(Equalizer).apply(this, arguments));
  176. }
  177. _createClass(Equalizer, [{
  178. key: "_setup",
  179. /**
  180. * Creates a new instance of Equalizer.
  181. * @class
  182. * @name Equalizer
  183. * @fires Equalizer#init
  184. * @param {Object} element - jQuery object to add the trigger to.
  185. * @param {Object} options - Overrides to the default plugin settings.
  186. */
  187. value: function _setup(element, options) {
  188. this.$element = element;
  189. this.options = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend({}, Equalizer.defaults, this.$element.data(), options);
  190. this.className = 'Equalizer'; // ie9 back compat
  191. this._init();
  192. }
  193. /**
  194. * Initializes the Equalizer plugin and calls functions to get equalizer functioning on load.
  195. * @private
  196. */
  197. }, {
  198. key: "_init",
  199. value: function _init() {
  200. var eqId = this.$element.attr('data-equalizer') || '';
  201. var $watched = this.$element.find("[data-equalizer-watch=\"".concat(eqId, "\"]"));
  202. _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1__["MediaQuery"]._init();
  203. this.$watched = $watched.length ? $watched : this.$element.find('[data-equalizer-watch]');
  204. this.$element.attr('data-resize', eqId || Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["GetYoDigits"])(6, 'eq'));
  205. this.$element.attr('data-mutate', eqId || Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["GetYoDigits"])(6, 'eq'));
  206. this.hasNested = this.$element.find('[data-equalizer]').length > 0;
  207. this.isNested = this.$element.parentsUntil(document.body, '[data-equalizer]').length > 0;
  208. this.isOn = false;
  209. this._bindHandler = {
  210. onResizeMeBound: this._onResizeMe.bind(this),
  211. onPostEqualizedBound: this._onPostEqualized.bind(this)
  212. };
  213. var imgs = this.$element.find('img');
  214. var tooSmall;
  215. if (this.options.equalizeOn) {
  216. tooSmall = this._checkMQ();
  217. jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).on('changed.zf.mediaquery', this._checkMQ.bind(this));
  218. } else {
  219. this._events();
  220. }
  221. if (typeof tooSmall !== 'undefined' && tooSmall === false || typeof tooSmall === 'undefined') {
  222. if (imgs.length) {
  223. Object(_foundation_util_imageLoader__WEBPACK_IMPORTED_MODULE_2__["onImagesLoaded"])(imgs, this._reflow.bind(this));
  224. } else {
  225. this._reflow();
  226. }
  227. }
  228. }
  229. /**
  230. * Removes event listeners if the breakpoint is too small.
  231. * @private
  232. */
  233. }, {
  234. key: "_pauseEvents",
  235. value: function _pauseEvents() {
  236. this.isOn = false;
  237. this.$element.off({
  238. '.zf.equalizer': this._bindHandler.onPostEqualizedBound,
  239. 'resizeme.zf.trigger': this._bindHandler.onResizeMeBound,
  240. 'mutateme.zf.trigger': this._bindHandler.onResizeMeBound
  241. });
  242. }
  243. /**
  244. * function to handle $elements resizeme.zf.trigger, with bound this on _bindHandler.onResizeMeBound
  245. * @private
  246. */
  247. }, {
  248. key: "_onResizeMe",
  249. value: function _onResizeMe(e) {
  250. this._reflow();
  251. }
  252. /**
  253. * function to handle $elements postequalized.zf.equalizer, with bound this on _bindHandler.onPostEqualizedBound
  254. * @private
  255. */
  256. }, {
  257. key: "_onPostEqualized",
  258. value: function _onPostEqualized(e) {
  259. if (e.target !== this.$element[0]) {
  260. this._reflow();
  261. }
  262. }
  263. /**
  264. * Initializes events for Equalizer.
  265. * @private
  266. */
  267. }, {
  268. key: "_events",
  269. value: function _events() {
  270. var _this = this;
  271. this._pauseEvents();
  272. if (this.hasNested) {
  273. this.$element.on('postequalized.zf.equalizer', this._bindHandler.onPostEqualizedBound);
  274. } else {
  275. this.$element.on('resizeme.zf.trigger', this._bindHandler.onResizeMeBound);
  276. this.$element.on('mutateme.zf.trigger', this._bindHandler.onResizeMeBound);
  277. }
  278. this.isOn = true;
  279. }
  280. /**
  281. * Checks the current breakpoint to the minimum required size.
  282. * @private
  283. */
  284. }, {
  285. key: "_checkMQ",
  286. value: function _checkMQ() {
  287. var tooSmall = !_foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1__["MediaQuery"].is(this.options.equalizeOn);
  288. if (tooSmall) {
  289. if (this.isOn) {
  290. this._pauseEvents();
  291. this.$watched.css('height', 'auto');
  292. }
  293. } else {
  294. if (!this.isOn) {
  295. this._events();
  296. }
  297. }
  298. return tooSmall;
  299. }
  300. /**
  301. * A noop version for the plugin
  302. * @private
  303. */
  304. }, {
  305. key: "_killswitch",
  306. value: function _killswitch() {
  307. return;
  308. }
  309. /**
  310. * Calls necessary functions to update Equalizer upon DOM change
  311. * @private
  312. */
  313. }, {
  314. key: "_reflow",
  315. value: function _reflow() {
  316. if (!this.options.equalizeOnStack) {
  317. if (this._isStacked()) {
  318. this.$watched.css('height', 'auto');
  319. return false;
  320. }
  321. }
  322. if (this.options.equalizeByRow) {
  323. this.getHeightsByRow(this.applyHeightByRow.bind(this));
  324. } else {
  325. this.getHeights(this.applyHeight.bind(this));
  326. }
  327. }
  328. /**
  329. * Manually determines if the first 2 elements are *NOT* stacked.
  330. * @private
  331. */
  332. }, {
  333. key: "_isStacked",
  334. value: function _isStacked() {
  335. if (!this.$watched[0] || !this.$watched[1]) {
  336. return true;
  337. }
  338. return this.$watched[0].getBoundingClientRect().top !== this.$watched[1].getBoundingClientRect().top;
  339. }
  340. /**
  341. * Finds the outer heights of children contained within an Equalizer parent and returns them in an array
  342. * @param {Function} cb - A non-optional callback to return the heights array to.
  343. * @returns {Array} heights - An array of heights of children within Equalizer container
  344. */
  345. }, {
  346. key: "getHeights",
  347. value: function getHeights(cb) {
  348. var heights = [];
  349. for (var i = 0, len = this.$watched.length; i < len; i++) {
  350. this.$watched[i].style.height = 'auto';
  351. heights.push(this.$watched[i].offsetHeight);
  352. }
  353. cb(heights);
  354. }
  355. /**
  356. * Finds the outer heights of children contained within an Equalizer parent and returns them in an array
  357. * @param {Function} cb - A non-optional callback to return the heights array to.
  358. * @returns {Array} groups - An array of heights of children within Equalizer container grouped by row with element,height and max as last child
  359. */
  360. }, {
  361. key: "getHeightsByRow",
  362. value: function getHeightsByRow(cb) {
  363. var lastElTopOffset = this.$watched.length ? this.$watched.first().offset().top : 0,
  364. groups = [],
  365. group = 0; //group by Row
  366. groups[group] = [];
  367. for (var i = 0, len = this.$watched.length; i < len; i++) {
  368. this.$watched[i].style.height = 'auto'; //maybe could use this.$watched[i].offsetTop
  369. var elOffsetTop = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this.$watched[i]).offset().top;
  370. if (elOffsetTop != lastElTopOffset) {
  371. group++;
  372. groups[group] = [];
  373. lastElTopOffset = elOffsetTop;
  374. }
  375. groups[group].push([this.$watched[i], this.$watched[i].offsetHeight]);
  376. }
  377. for (var j = 0, ln = groups.length; j < ln; j++) {
  378. var heights = jquery__WEBPACK_IMPORTED_MODULE_0___default()(groups[j]).map(function () {
  379. return this[1];
  380. }).get();
  381. var max = Math.max.apply(null, heights);
  382. groups[j].push(max);
  383. }
  384. cb(groups);
  385. }
  386. /**
  387. * Changes the CSS height property of each child in an Equalizer parent to match the tallest
  388. * @param {array} heights - An array of heights of children within Equalizer container
  389. * @fires Equalizer#preequalized
  390. * @fires Equalizer#postequalized
  391. */
  392. }, {
  393. key: "applyHeight",
  394. value: function applyHeight(heights) {
  395. var max = Math.max.apply(null, heights);
  396. /**
  397. * Fires before the heights are applied
  398. * @event Equalizer#preequalized
  399. */
  400. this.$element.trigger('preequalized.zf.equalizer');
  401. this.$watched.css('height', max);
  402. /**
  403. * Fires when the heights have been applied
  404. * @event Equalizer#postequalized
  405. */
  406. this.$element.trigger('postequalized.zf.equalizer');
  407. }
  408. /**
  409. * Changes the CSS height property of each child in an Equalizer parent to match the tallest by row
  410. * @param {array} groups - An array of heights of children within Equalizer container grouped by row with element,height and max as last child
  411. * @fires Equalizer#preequalized
  412. * @fires Equalizer#preequalizedrow
  413. * @fires Equalizer#postequalizedrow
  414. * @fires Equalizer#postequalized
  415. */
  416. }, {
  417. key: "applyHeightByRow",
  418. value: function applyHeightByRow(groups) {
  419. /**
  420. * Fires before the heights are applied
  421. */
  422. this.$element.trigger('preequalized.zf.equalizer');
  423. for (var i = 0, len = groups.length; i < len; i++) {
  424. var groupsILength = groups[i].length,
  425. max = groups[i][groupsILength - 1];
  426. if (groupsILength <= 2) {
  427. jquery__WEBPACK_IMPORTED_MODULE_0___default()(groups[i][0][0]).css({
  428. 'height': 'auto'
  429. });
  430. continue;
  431. }
  432. /**
  433. * Fires before the heights per row are applied
  434. * @event Equalizer#preequalizedrow
  435. */
  436. this.$element.trigger('preequalizedrow.zf.equalizer');
  437. for (var j = 0, lenJ = groupsILength - 1; j < lenJ; j++) {
  438. jquery__WEBPACK_IMPORTED_MODULE_0___default()(groups[i][j][0]).css({
  439. 'height': max
  440. });
  441. }
  442. /**
  443. * Fires when the heights per row have been applied
  444. * @event Equalizer#postequalizedrow
  445. */
  446. this.$element.trigger('postequalizedrow.zf.equalizer');
  447. }
  448. /**
  449. * Fires when the heights have been applied
  450. */
  451. this.$element.trigger('postequalized.zf.equalizer');
  452. }
  453. /**
  454. * Destroys an instance of Equalizer.
  455. * @function
  456. */
  457. }, {
  458. key: "_destroy",
  459. value: function _destroy() {
  460. this._pauseEvents();
  461. this.$watched.css('height', 'auto');
  462. }
  463. }]);
  464. return Equalizer;
  465. }(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["Plugin"]);
  466. /**
  467. * Default settings for plugin
  468. */
  469. Equalizer.defaults = {
  470. /**
  471. * Enable height equalization when stacked on smaller screens.
  472. * @option
  473. * @type {boolean}
  474. * @default false
  475. */
  476. equalizeOnStack: false,
  477. /**
  478. * Enable height equalization row by row.
  479. * @option
  480. * @type {boolean}
  481. * @default false
  482. */
  483. equalizeByRow: false,
  484. /**
  485. * String representing the minimum breakpoint size the plugin should equalize heights on.
  486. * @option
  487. * @type {string}
  488. * @default ''
  489. */
  490. equalizeOn: ''
  491. };
  492. /***/ }),
  493. /***/ 6:
  494. /*!**********************************************************!*\
  495. !*** multi ./js/entries/plugins/foundation.equalizer.js ***!
  496. \**********************************************************/
  497. /*! no static exports found */
  498. /***/ (function(module, exports, __webpack_require__) {
  499. module.exports = __webpack_require__(/*! /Users/joeworkman/Development/foundation-sites/js/entries/plugins/foundation.equalizer.js */"./js/entries/plugins/foundation.equalizer.js");
  500. /***/ }),
  501. /***/ "jquery":
  502. /*!********************************************************************************************!*\
  503. !*** external {"root":["jQuery"],"amd":"jquery","commonjs":"jquery","commonjs2":"jquery"} ***!
  504. \********************************************************************************************/
  505. /*! no static exports found */
  506. /***/ (function(module, exports) {
  507. module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__;
  508. /***/ })
  509. /******/ });
  510. });
  511. //# sourceMappingURL=foundation.equalizer.js.map