123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886 |
- (function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory(require("./foundation.core"), require("./foundation.util.imageLoader"), require("./foundation.util.keyboard"), require("./foundation.util.motion"), require("./foundation.util.timer"), require("./foundation.util.touch"), require("jquery"));
- else if(typeof define === 'function' && define.amd)
- define(["./foundation.core", "./foundation.util.imageLoader", "./foundation.util.keyboard", "./foundation.util.motion", "./foundation.util.timer", "./foundation.util.touch", "jquery"], factory);
- else if(typeof exports === 'object')
- exports["foundation.orbit"] = factory(require("./foundation.core"), require("./foundation.util.imageLoader"), require("./foundation.util.keyboard"), require("./foundation.util.motion"), require("./foundation.util.timer"), require("./foundation.util.touch"), require("jquery"));
- else
- root["__FOUNDATION_EXTERNAL__"] = root["__FOUNDATION_EXTERNAL__"] || {}, root["__FOUNDATION_EXTERNAL__"]["foundation.orbit"] = factory(root["__FOUNDATION_EXTERNAL__"]["foundation.core"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.imageLoader"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.keyboard"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.motion"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.timer"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.touch"], root["jQuery"]);
- })(window, function(__WEBPACK_EXTERNAL_MODULE__foundation_core__, __WEBPACK_EXTERNAL_MODULE__foundation_util_imageLoader__, __WEBPACK_EXTERNAL_MODULE__foundation_util_keyboard__, __WEBPACK_EXTERNAL_MODULE__foundation_util_motion__, __WEBPACK_EXTERNAL_MODULE__foundation_util_timer__, __WEBPACK_EXTERNAL_MODULE__foundation_util_touch__, __WEBPACK_EXTERNAL_MODULE_jquery__) {
- return /******/ (function(modules) { // webpackBootstrap
- /******/ // The module cache
- /******/ var installedModules = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/
- /******/ // Check if module is in cache
- /******/ if(installedModules[moduleId]) {
- /******/ return installedModules[moduleId].exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = installedModules[moduleId] = {
- /******/ i: moduleId,
- /******/ l: false,
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Flag the module as loaded
- /******/ module.l = true;
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = modules;
- /******/
- /******/ // expose the module cache
- /******/ __webpack_require__.c = installedModules;
- /******/
- /******/ // define getter function for harmony exports
- /******/ __webpack_require__.d = function(exports, name, getter) {
- /******/ if(!__webpack_require__.o(exports, name)) {
- /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
- /******/ }
- /******/ };
- /******/
- /******/ // 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 });
- /******/ };
- /******/
- /******/ // create a fake namespace object
- /******/ // mode & 1: value is a module id, require it
- /******/ // mode & 2: merge all properties of value into the ns
- /******/ // mode & 4: return value when already ns object
- /******/ // mode & 8|1: behave like require
- /******/ __webpack_require__.t = function(value, mode) {
- /******/ if(mode & 1) value = __webpack_require__(value);
- /******/ if(mode & 8) return value;
- /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
- /******/ var ns = Object.create(null);
- /******/ __webpack_require__.r(ns);
- /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
- /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
- /******/ return ns;
- /******/ };
- /******/
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = function(module) {
- /******/ var getter = module && module.__esModule ?
- /******/ function getDefault() { return module['default']; } :
- /******/ function getModuleExports() { return module; };
- /******/ __webpack_require__.d(getter, 'a', getter);
- /******/ return getter;
- /******/ };
- /******/
- /******/ // Object.prototype.hasOwnProperty.call
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
- /******/
- /******/ // __webpack_public_path__
- /******/ __webpack_require__.p = "";
- /******/
- /******/
- /******/ // Load entry module and return exports
- /******/ return __webpack_require__(__webpack_require__.s = 10);
- /******/ })
- /************************************************************************/
- /******/ ({
- /***/ "./foundation.core":
- /*!****************************************************************************************************************************************************************!*\
- !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.core"],"amd":"./foundation.core","commonjs":"./foundation.core","commonjs2":"./foundation.core"} ***!
- \****************************************************************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_core__;
- /***/ }),
- /***/ "./foundation.util.imageLoader":
- /*!****************************************************************************************************************************************************************************************************************!*\
- !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.imageLoader"],"amd":"./foundation.util.imageLoader","commonjs":"./foundation.util.imageLoader","commonjs2":"./foundation.util.imageLoader"} ***!
- \****************************************************************************************************************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_imageLoader__;
- /***/ }),
- /***/ "./foundation.util.keyboard":
- /*!****************************************************************************************************************************************************************************************************!*\
- !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.keyboard"],"amd":"./foundation.util.keyboard","commonjs":"./foundation.util.keyboard","commonjs2":"./foundation.util.keyboard"} ***!
- \****************************************************************************************************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_keyboard__;
- /***/ }),
- /***/ "./foundation.util.motion":
- /*!********************************************************************************************************************************************************************************************!*\
- !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.motion"],"amd":"./foundation.util.motion","commonjs":"./foundation.util.motion","commonjs2":"./foundation.util.motion"} ***!
- \********************************************************************************************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_motion__;
- /***/ }),
- /***/ "./foundation.util.timer":
- /*!****************************************************************************************************************************************************************************************!*\
- !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.timer"],"amd":"./foundation.util.timer","commonjs":"./foundation.util.timer","commonjs2":"./foundation.util.timer"} ***!
- \****************************************************************************************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_timer__;
- /***/ }),
- /***/ "./foundation.util.touch":
- /*!****************************************************************************************************************************************************************************************!*\
- !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.touch"],"amd":"./foundation.util.touch","commonjs":"./foundation.util.touch","commonjs2":"./foundation.util.touch"} ***!
- \****************************************************************************************************************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_touch__;
- /***/ }),
- /***/ "./js/entries/plugins/foundation.orbit.js":
- /*!************************************************!*\
- !*** ./js/entries/plugins/foundation.orbit.js ***!
- \************************************************/
- /*! exports provided: Foundation, Orbit */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* 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 reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Foundation", function() { return _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"]; });
- /* harmony import */ var _foundation_orbit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../foundation.orbit */ "./js/foundation.orbit.js");
- /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Orbit", function() { return _foundation_orbit__WEBPACK_IMPORTED_MODULE_1__["Orbit"]; });
- _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"].plugin(_foundation_orbit__WEBPACK_IMPORTED_MODULE_1__["Orbit"], 'Orbit');
- /***/ }),
- /***/ "./js/foundation.orbit.js":
- /*!********************************!*\
- !*** ./js/foundation.orbit.js ***!
- \********************************/
- /*! exports provided: Orbit */
- /***/ (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Orbit", function() { return Orbit; });
- /* 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__);
- /* harmony import */ var _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation.util.keyboard */ "./foundation.util.keyboard");
- /* harmony import */ var _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _foundation_util_motion__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation.util.motion */ "./foundation.util.motion");
- /* harmony import */ var _foundation_util_motion__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_motion__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _foundation_util_timer__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./foundation.util.timer */ "./foundation.util.timer");
- /* harmony import */ var _foundation_util_timer__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_timer__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _foundation_util_imageLoader__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./foundation.util.imageLoader */ "./foundation.util.imageLoader");
- /* harmony import */ var _foundation_util_imageLoader__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_imageLoader__WEBPACK_IMPORTED_MODULE_4__);
- /* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./foundation.core.utils */ "./foundation.core");
- /* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_5__);
- /* harmony import */ var _foundation_util_touch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./foundation.util.touch */ "./foundation.util.touch");
- /* harmony import */ var _foundation_util_touch__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_touch__WEBPACK_IMPORTED_MODULE_6__);
- 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); }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- 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); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
- 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); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- /**
- * Orbit module.
- * @module foundation.orbit
- * @requires foundation.util.keyboard
- * @requires foundation.util.motion
- * @requires foundation.util.timer
- * @requires foundation.util.imageLoader
- * @requires foundation.util.touch
- */
- var Orbit =
- /*#__PURE__*/
- function (_Plugin) {
- _inherits(Orbit, _Plugin);
- function Orbit() {
- _classCallCheck(this, Orbit);
- return _possibleConstructorReturn(this, _getPrototypeOf(Orbit).apply(this, arguments));
- }
- _createClass(Orbit, [{
- key: "_setup",
- /**
- * Creates a new instance of an orbit carousel.
- * @class
- * @name Orbit
- * @param {jQuery} element - jQuery object to make into an Orbit Carousel.
- * @param {Object} options - Overrides to the default plugin settings.
- */
- value: function _setup(element, options) {
- this.$element = element;
- this.options = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend({}, Orbit.defaults, this.$element.data(), options);
- this.className = 'Orbit'; // ie9 back compat
- _foundation_util_touch__WEBPACK_IMPORTED_MODULE_6__["Touch"].init(jquery__WEBPACK_IMPORTED_MODULE_0___default.a); // Touch init is idempotent, we just need to make sure it's initialied.
- this._init();
- _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__["Keyboard"].register('Orbit', {
- 'ltr': {
- 'ARROW_RIGHT': 'next',
- 'ARROW_LEFT': 'previous'
- },
- 'rtl': {
- 'ARROW_LEFT': 'next',
- 'ARROW_RIGHT': 'previous'
- }
- });
- }
- /**
- * Initializes the plugin by creating jQuery collections, setting attributes, and starting the animation.
- * @function
- * @private
- */
- }, {
- key: "_init",
- value: function _init() {
- // @TODO: consider discussion on PR #9278 about DOM pollution by changeSlide
- this._reset();
- this.$wrapper = this.$element.find(".".concat(this.options.containerClass));
- this.$slides = this.$element.find(".".concat(this.options.slideClass));
- var $images = this.$element.find('img'),
- initActive = this.$slides.filter('.is-active'),
- id = this.$element[0].id || Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_5__["GetYoDigits"])(6, 'orbit');
- this.$element.attr({
- 'data-resize': id,
- 'id': id
- });
- if (!initActive.length) {
- this.$slides.eq(0).addClass('is-active');
- }
- if (!this.options.useMUI) {
- this.$slides.addClass('no-motionui');
- }
- if ($images.length) {
- Object(_foundation_util_imageLoader__WEBPACK_IMPORTED_MODULE_4__["onImagesLoaded"])($images, this._prepareForOrbit.bind(this));
- } else {
- this._prepareForOrbit(); //hehe
- }
- if (this.options.bullets) {
- this._loadBullets();
- }
- this._events();
- if (this.options.autoPlay && this.$slides.length > 1) {
- this.geoSync();
- }
- if (this.options.accessible) {
- // allow wrapper to be focusable to enable arrow navigation
- this.$wrapper.attr('tabindex', 0);
- }
- }
- /**
- * Creates a jQuery collection of bullets, if they are being used.
- * @function
- * @private
- */
- }, {
- key: "_loadBullets",
- value: function _loadBullets() {
- this.$bullets = this.$element.find(".".concat(this.options.boxOfBullets)).find('button');
- }
- /**
- * Sets a `timer` object on the orbit, and starts the counter for the next slide.
- * @function
- */
- }, {
- key: "geoSync",
- value: function geoSync() {
- var _this = this;
- this.timer = new _foundation_util_timer__WEBPACK_IMPORTED_MODULE_3__["Timer"](this.$element, {
- duration: this.options.timerDelay,
- infinite: false
- }, function () {
- _this.changeSlide(true);
- });
- this.timer.start();
- }
- /**
- * Sets wrapper and slide heights for the orbit.
- * @function
- * @private
- */
- }, {
- key: "_prepareForOrbit",
- value: function _prepareForOrbit() {
- var _this = this;
- this._setWrapperHeight();
- }
- /**
- * Calulates the height of each slide in the collection, and uses the tallest one for the wrapper height.
- * @function
- * @private
- * @param {Function} cb - a callback function to fire when complete.
- */
- }, {
- key: "_setWrapperHeight",
- value: function _setWrapperHeight(cb) {
- //rewrite this to `for` loop
- var max = 0,
- temp,
- counter = 0,
- _this = this;
- this.$slides.each(function () {
- temp = this.getBoundingClientRect().height;
- jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).attr('data-slide', counter); // hide all slides but the active one
- if (!/mui/g.test(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this)[0].className) && _this.$slides.filter('.is-active')[0] !== _this.$slides.eq(counter)[0]) {
- jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).css({
- 'display': 'none'
- });
- }
- max = temp > max ? temp : max;
- counter++;
- });
- if (counter === this.$slides.length) {
- this.$wrapper.css({
- 'height': max
- }); //only change the wrapper height property once.
- if (cb) {
- cb(max);
- } //fire callback with max height dimension.
- }
- }
- /**
- * Sets the max-height of each slide.
- * @function
- * @private
- */
- }, {
- key: "_setSlideHeight",
- value: function _setSlideHeight(height) {
- this.$slides.each(function () {
- jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).css('max-height', height);
- });
- }
- /**
- * Adds event listeners to basically everything within the element.
- * @function
- * @private
- */
- }, {
- key: "_events",
- value: function _events() {
- var _this = this; //***************************************
- //**Now using custom event - thanks to:**
- //** Yohai Ararat of Toronto **
- //***************************************
- //
- this.$element.off('.resizeme.zf.trigger').on({
- 'resizeme.zf.trigger': this._prepareForOrbit.bind(this)
- });
- if (this.$slides.length > 1) {
- if (this.options.swipe) {
- this.$slides.off('swipeleft.zf.orbit swiperight.zf.orbit').on('swipeleft.zf.orbit', function (e) {
- e.preventDefault();
- _this.changeSlide(true);
- }).on('swiperight.zf.orbit', function (e) {
- e.preventDefault();
- _this.changeSlide(false);
- });
- } //***************************************
- if (this.options.autoPlay) {
- this.$slides.on('click.zf.orbit', function () {
- _this.$element.data('clickedOn', _this.$element.data('clickedOn') ? false : true);
- _this.timer[_this.$element.data('clickedOn') ? 'pause' : 'start']();
- });
- if (this.options.pauseOnHover) {
- this.$element.on('mouseenter.zf.orbit', function () {
- _this.timer.pause();
- }).on('mouseleave.zf.orbit', function () {
- if (!_this.$element.data('clickedOn')) {
- _this.timer.start();
- }
- });
- }
- }
- if (this.options.navButtons) {
- var $controls = this.$element.find(".".concat(this.options.nextClass, ", .").concat(this.options.prevClass));
- $controls.attr('tabindex', 0) //also need to handle enter/return and spacebar key presses
- .on('click.zf.orbit touchend.zf.orbit', function (e) {
- e.preventDefault();
- _this.changeSlide(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).hasClass(_this.options.nextClass));
- });
- }
- if (this.options.bullets) {
- this.$bullets.on('click.zf.orbit touchend.zf.orbit', function () {
- if (/is-active/g.test(this.className)) {
- return false;
- } //if this is active, kick out of function.
- var idx = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('slide'),
- ltr = idx > _this.$slides.filter('.is-active').data('slide'),
- $slide = _this.$slides.eq(idx);
- _this.changeSlide(ltr, $slide, idx);
- });
- }
- if (this.options.accessible) {
- this.$wrapper.add(this.$bullets).on('keydown.zf.orbit', function (e) {
- // handle keyboard event with keyboard util
- _foundation_util_keyboard__WEBPACK_IMPORTED_MODULE_1__["Keyboard"].handleKey(e, 'Orbit', {
- next: function next() {
- _this.changeSlide(true);
- },
- previous: function previous() {
- _this.changeSlide(false);
- },
- handled: function handled() {
- // if bullet is focused, make sure focus moves
- if (jquery__WEBPACK_IMPORTED_MODULE_0___default()(e.target).is(_this.$bullets)) {
- _this.$bullets.filter('.is-active').focus();
- }
- }
- });
- });
- }
- }
- }
- /**
- * Resets Orbit so it can be reinitialized
- */
- }, {
- key: "_reset",
- value: function _reset() {
- // Don't do anything if there are no slides (first run)
- if (typeof this.$slides == 'undefined') {
- return;
- }
- if (this.$slides.length > 1) {
- // Remove old events
- this.$element.off('.zf.orbit').find('*').off('.zf.orbit'); // Restart timer if autoPlay is enabled
- if (this.options.autoPlay) {
- this.timer.restart();
- } // Reset all sliddes
- this.$slides.each(function (el) {
- jquery__WEBPACK_IMPORTED_MODULE_0___default()(el).removeClass('is-active is-active is-in').removeAttr('aria-live').hide();
- }); // Show the first slide
- this.$slides.first().addClass('is-active').show(); // Triggers when the slide has finished animating
- this.$element.trigger('slidechange.zf.orbit', [this.$slides.first()]); // Select first bullet if bullets are present
- if (this.options.bullets) {
- this._updateBullets(0);
- }
- }
- }
- /**
- * Changes the current slide to a new one.
- * @function
- * @param {Boolean} isLTR - if true the slide moves from right to left, if false the slide moves from left to right.
- * @param {jQuery} chosenSlide - the jQuery element of the slide to show next, if one is selected.
- * @param {Number} idx - the index of the new slide in its collection, if one chosen.
- * @fires Orbit#slidechange
- */
- }, {
- key: "changeSlide",
- value: function changeSlide(isLTR, chosenSlide, idx) {
- if (!this.$slides) {
- return;
- } // Don't freak out if we're in the middle of cleanup
- var $curSlide = this.$slides.filter('.is-active').eq(0);
- if (/mui/g.test($curSlide[0].className)) {
- return false;
- } //if the slide is currently animating, kick out of the function
- var $firstSlide = this.$slides.first(),
- $lastSlide = this.$slides.last(),
- dirIn = isLTR ? 'Right' : 'Left',
- dirOut = isLTR ? 'Left' : 'Right',
- _this = this,
- $newSlide;
- if (!chosenSlide) {
- //most of the time, this will be auto played or clicked from the navButtons.
- $newSlide = isLTR ? //if wrapping enabled, check to see if there is a `next` or `prev` sibling, if not, select the first or last slide to fill in. if wrapping not enabled, attempt to select `next` or `prev`, if there's nothing there, the function will kick out on next step. CRAZY NESTED TERNARIES!!!!!
- this.options.infiniteWrap ? $curSlide.next(".".concat(this.options.slideClass)).length ? $curSlide.next(".".concat(this.options.slideClass)) : $firstSlide : $curSlide.next(".".concat(this.options.slideClass)) : //pick next slide if moving left to right
- this.options.infiniteWrap ? $curSlide.prev(".".concat(this.options.slideClass)).length ? $curSlide.prev(".".concat(this.options.slideClass)) : $lastSlide : $curSlide.prev(".".concat(this.options.slideClass)); //pick prev slide if moving right to left
- } else {
- $newSlide = chosenSlide;
- }
- if ($newSlide.length) {
- /**
- * Triggers before the next slide starts animating in and only if a next slide has been found.
- * @event Orbit#beforeslidechange
- */
- this.$element.trigger('beforeslidechange.zf.orbit', [$curSlide, $newSlide]);
- if (this.options.bullets) {
- idx = idx || this.$slides.index($newSlide); //grab index to update bullets
- this._updateBullets(idx);
- }
- if (this.options.useMUI && !this.$element.is(':hidden')) {
- _foundation_util_motion__WEBPACK_IMPORTED_MODULE_2__["Motion"].animateIn($newSlide.addClass('is-active'), this.options["animInFrom".concat(dirIn)], function () {
- $newSlide.css({
- 'display': 'block'
- }).attr('aria-live', 'polite');
- });
- _foundation_util_motion__WEBPACK_IMPORTED_MODULE_2__["Motion"].animateOut($curSlide.removeClass('is-active'), this.options["animOutTo".concat(dirOut)], function () {
- $curSlide.removeAttr('aria-live');
- if (_this.options.autoPlay && !_this.timer.isPaused) {
- _this.timer.restart();
- } //do stuff?
- });
- } else {
- $curSlide.removeClass('is-active is-in').removeAttr('aria-live').hide();
- $newSlide.addClass('is-active is-in').attr('aria-live', 'polite').show();
- if (this.options.autoPlay && !this.timer.isPaused) {
- this.timer.restart();
- }
- }
- /**
- * Triggers when the slide has finished animating in.
- * @event Orbit#slidechange
- */
- this.$element.trigger('slidechange.zf.orbit', [$newSlide]);
- }
- }
- /**
- * Updates the active state of the bullets, if displayed.
- * Move the descriptor of the current slide `[data-slide-active-label]` to the newly active bullet.
- * If no `[data-slide-active-label]` is set, will move the exceeding `span` element.
- *
- * @function
- * @private
- * @param {Number} idx - the index of the current slide.
- */
- }, {
- key: "_updateBullets",
- value: function _updateBullets(idx) {
- var $oldBullet = this.$bullets.filter('.is-active');
- var $othersBullets = this.$bullets.not('.is-active');
- var $newBullet = this.$bullets.eq(idx);
- $oldBullet.removeClass('is-active').blur();
- $newBullet.addClass('is-active'); // Find the descriptor for the current slide to move it to the new slide button
- var activeStateDescriptor = $oldBullet.children('[data-slide-active-label]').last(); // If not explicitely given, search for the last "exceeding" span element (compared to others bullets).
- if (!activeStateDescriptor.length) {
- var spans = $oldBullet.children('span');
- var spanCountInOthersBullets = $othersBullets.toArray().map(function (b) {
- return jquery__WEBPACK_IMPORTED_MODULE_0___default()(b).children('span').length;
- }); // If there is an exceeding span element, use it as current slide descriptor
- if (spanCountInOthersBullets.every(function (count) {
- return count < spans.length;
- })) {
- activeStateDescriptor = spans.last();
- activeStateDescriptor.attr('data-slide-active-label', '');
- }
- } // Move the current slide descriptor to the new slide button
- if (activeStateDescriptor.length) {
- activeStateDescriptor.detach();
- $newBullet.append(activeStateDescriptor);
- }
- }
- /**
- * Destroys the carousel and hides the element.
- * @function
- */
- }, {
- key: "_destroy",
- value: function _destroy() {
- this.$element.off('.zf.orbit').find('*').off('.zf.orbit').end().hide();
- }
- }]);
- return Orbit;
- }(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_5__["Plugin"]);
- Orbit.defaults = {
- /**
- * Tells the JS to look for and loadBullets.
- * @option
- * @type {boolean}
- * @default true
- */
- bullets: true,
- /**
- * Tells the JS to apply event listeners to nav buttons
- * @option
- * @type {boolean}
- * @default true
- */
- navButtons: true,
- /**
- * motion-ui animation class to apply
- * @option
- * @type {string}
- * @default 'slide-in-right'
- */
- animInFromRight: 'slide-in-right',
- /**
- * motion-ui animation class to apply
- * @option
- * @type {string}
- * @default 'slide-out-right'
- */
- animOutToRight: 'slide-out-right',
- /**
- * motion-ui animation class to apply
- * @option
- * @type {string}
- * @default 'slide-in-left'
- *
- */
- animInFromLeft: 'slide-in-left',
- /**
- * motion-ui animation class to apply
- * @option
- * @type {string}
- * @default 'slide-out-left'
- */
- animOutToLeft: 'slide-out-left',
- /**
- * Allows Orbit to automatically animate on page load.
- * @option
- * @type {boolean}
- * @default true
- */
- autoPlay: true,
- /**
- * Amount of time, in ms, between slide transitions
- * @option
- * @type {number}
- * @default 5000
- */
- timerDelay: 5000,
- /**
- * Allows Orbit to infinitely loop through the slides
- * @option
- * @type {boolean}
- * @default true
- */
- infiniteWrap: true,
- /**
- * Allows the Orbit slides to bind to swipe events for mobile, requires an additional util library
- * @option
- * @type {boolean}
- * @default true
- */
- swipe: true,
- /**
- * Allows the timing function to pause animation on hover.
- * @option
- * @type {boolean}
- * @default true
- */
- pauseOnHover: true,
- /**
- * Allows Orbit to bind keyboard events to the slider, to animate frames with arrow keys
- * @option
- * @type {boolean}
- * @default true
- */
- accessible: true,
- /**
- * Class applied to the container of Orbit
- * @option
- * @type {string}
- * @default 'orbit-container'
- */
- containerClass: 'orbit-container',
- /**
- * Class applied to individual slides.
- * @option
- * @type {string}
- * @default 'orbit-slide'
- */
- slideClass: 'orbit-slide',
- /**
- * Class applied to the bullet container. You're welcome.
- * @option
- * @type {string}
- * @default 'orbit-bullets'
- */
- boxOfBullets: 'orbit-bullets',
- /**
- * Class applied to the `next` navigation button.
- * @option
- * @type {string}
- * @default 'orbit-next'
- */
- nextClass: 'orbit-next',
- /**
- * Class applied to the `previous` navigation button.
- * @option
- * @type {string}
- * @default 'orbit-previous'
- */
- prevClass: 'orbit-previous',
- /**
- * Boolean to flag the js to use motion ui classes or not. Default to true for backwards compatibility.
- * @option
- * @type {boolean}
- * @default true
- */
- useMUI: true
- };
- /***/ }),
- /***/ 10:
- /*!******************************************************!*\
- !*** multi ./js/entries/plugins/foundation.orbit.js ***!
- \******************************************************/
- /*! no static exports found */
- /***/ (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__(/*! /Users/joeworkman/Development/foundation-sites/js/entries/plugins/foundation.orbit.js */"./js/entries/plugins/foundation.orbit.js");
- /***/ }),
- /***/ "jquery":
- /*!********************************************************************************************!*\
- !*** external {"root":["jQuery"],"amd":"jquery","commonjs":"jquery","commonjs2":"jquery"} ***!
- \********************************************************************************************/
- /*! no static exports found */
- /***/ (function(module, exports) {
- module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__;
- /***/ })
- /******/ });
- });
- //# sourceMappingURL=foundation.orbit.js.map
|