UNPKG

foundation-sites

Version:

The most advanced responsive front-end framework in the world.

178 lines (162 loc) 8.23 kB
(function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("./foundation.core"), require("jquery")); else if(typeof define === 'function' && define.amd) define(["./foundation.core", "jquery"], factory); else if(typeof exports === 'object') exports["__FOUNDATION_EXTERNAL__"] = factory(require("./foundation.core"), require("jquery")); else root["__FOUNDATION_EXTERNAL__"] = root["__FOUNDATION_EXTERNAL__"] || {}, root["__FOUNDATION_EXTERNAL__"]["foundation.util.imageLoader"] = factory(root["__FOUNDATION_EXTERNAL__"]["foundation.core"], root["jQuery"]); })(self, function(__WEBPACK_EXTERNAL_MODULE__foundation_core__, __WEBPACK_EXTERNAL_MODULE_jquery__) { return /******/ (function() { // webpackBootstrap /******/ "use strict"; /******/ var __webpack_modules__ = ({ /***/ "./js/foundation.util.imageLoader.js": /*!*******************************************!*\ !*** ./js/foundation.util.imageLoader.js ***! \*******************************************/ /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ onImagesLoaded: function() { return /* binding */ onImagesLoaded; } /* harmony export */ }); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); /** * Runs a callback function when images are fully loaded. * @param {Object} images - Image(s) to check if loaded. * @param {Func} callback - Function to execute when image is fully loaded. */ function onImagesLoaded(images, callback) { var unloaded = images.length; if (unloaded === 0) { callback(); } images.each(function () { // Check if image is loaded if (this.complete && typeof this.naturalWidth !== 'undefined') { singleImageLoaded(); } else { // If the above check failed, simulate loading on detached element. var image = new Image(); // Still count image as loaded if it finalizes with an error. var events = "load.zf.images error.zf.images"; jquery__WEBPACK_IMPORTED_MODULE_0___default()(image).one(events, function me() { // Unbind the event listeners. We're using 'one' but only one of the two events will have fired. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).off(events, me); singleImageLoaded(); }); image.src = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).attr('src'); } }); function singleImageLoaded() { unloaded--; if (unloaded === 0) { callback(); } } } /***/ }), /***/ "./foundation.core": /*!****************************************************************************************************************************************************************!*\ !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.core"],"amd":"./foundation.core","commonjs":"./foundation.core","commonjs2":"./foundation.core"} ***! \****************************************************************************************************************************************************************/ /***/ (function(module) { module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_core__; /***/ }), /***/ "jquery": /*!********************************************************************************************!*\ !*** external {"root":["jQuery"],"amd":"jquery","commonjs":"jquery","commonjs2":"jquery"} ***! \********************************************************************************************/ /***/ (function(module) { module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ var cachedModule = __webpack_module_cache__[moduleId]; /******/ if (cachedModule !== undefined) { /******/ return cachedModule.exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ !function() { /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function() { return module['default']; } : /******/ function() { return module; }; /******/ __webpack_require__.d(getter, { a: getter }); /******/ return getter; /******/ }; /******/ }(); /******/ /******/ /* webpack/runtime/define property getters */ /******/ !function() { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = function(exports, definition) { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ }(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ !function() { /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } /******/ }(); /******/ /******/ /* webpack/runtime/make namespace object */ /******/ !function() { /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ }(); /******/ /************************************************************************/ var __webpack_exports__ = {}; // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. !function() { /*!***********************************************************!*\ !*** ./js/entries/plugins/foundation.util.imageLoader.js ***! \***********************************************************/ __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Foundation: function() { return /* reexport safe */ _foundation_core__WEBPACK_IMPORTED_MODULE_0__.Foundation; }, /* harmony export */ onImagesLoaded: function() { return /* reexport safe */ _foundation_util_imageLoader__WEBPACK_IMPORTED_MODULE_1__.onImagesLoaded; } /* harmony export */ }); /* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./foundation.core */ "./foundation.core"); /* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_foundation_core__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _foundation_util_imageLoader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../foundation.util.imageLoader */ "./js/foundation.util.imageLoader.js"); _foundation_core__WEBPACK_IMPORTED_MODULE_0__.Foundation.onImagesLoaded = _foundation_util_imageLoader__WEBPACK_IMPORTED_MODULE_1__.onImagesLoaded; }(); /******/ return __webpack_exports__; /******/ })() ; }); //# sourceMappingURL=foundation.util.imageLoader.js.map