carousel.js 14.9 KB
Newer Older
Mark Otto's avatar
dist    
Mark Otto committed
1
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); } }
Mark Otto's avatar
dist    
Mark Otto committed
2

Mark Otto's avatar
dist    
Mark Otto committed
3
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
fat's avatar
fat committed
4
5
6

/**
 * --------------------------------------------------------------------------
Mark Otto's avatar
Mark Otto committed
7
 * Bootstrap (v4.0.0-beta.2): carousel.js
fat's avatar
fat committed
8
9
10
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 * --------------------------------------------------------------------------
 */
Mark Otto's avatar
dist    
Mark Otto committed
11
var Carousel = function ($) {
fat's avatar
fat committed
12
13
14
15
16
17
  /**
   * ------------------------------------------------------------------------
   * Constants
   * ------------------------------------------------------------------------
   */
  var NAME = 'carousel';
Mark Otto's avatar
Mark Otto committed
18
  var VERSION = '4.0.0-beta.2';
fat's avatar
fat committed
19
  var DATA_KEY = 'bs.carousel';
Mark Otto's avatar
dist    
Mark Otto committed
20
  var EVENT_KEY = "." + DATA_KEY;
fat's avatar
fat committed
21
  var DATA_API_KEY = '.data-api';
fat's avatar
fat committed
22
23
  var JQUERY_NO_CONFLICT = $.fn[NAME];
  var TRANSITION_DURATION = 600;
Chris Rebert's avatar
grunt    
Chris Rebert committed
24
  var ARROW_LEFT_KEYCODE = 37; // KeyboardEvent.which value for left arrow key
Mark Otto's avatar
dist    
Mark Otto committed
25

Chris Rebert's avatar
grunt    
Chris Rebert committed
26
  var ARROW_RIGHT_KEYCODE = 39; // KeyboardEvent.which value for right arrow key
Mark Otto's avatar
dist    
Mark Otto committed
27

Mark Otto's avatar
build    
Mark Otto committed
28
  var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch
fat's avatar
fat committed
29

30
  var Default = {
fat's avatar
fat committed
31
32
33
34
35
    interval: 5000,
    keyboard: true,
    slide: false,
    pause: 'hover',
    wrap: true
fat's avatar
fat committed
36
  };
fat's avatar
fat committed
37
38
39
40
  var DefaultType = {
    interval: '(number|boolean)',
    keyboard: 'boolean',
    slide: '(boolean|string)',
41
    pause: '(string|boolean)',
fat's avatar
fat committed
42
43
    wrap: 'boolean'
  };
fat's avatar
fat committed
44
45
  var Direction = {
    NEXT: 'next',
Mark Otto's avatar
grunt    
Mark Otto committed
46
47
48
    PREV: 'prev',
    LEFT: 'left',
    RIGHT: 'right'
fat's avatar
fat committed
49
50
  };
  var Event = {
Mark Otto's avatar
dist    
Mark Otto committed
51
52
53
54
55
56
57
58
    SLIDE: "slide" + EVENT_KEY,
    SLID: "slid" + EVENT_KEY,
    KEYDOWN: "keydown" + EVENT_KEY,
    MOUSEENTER: "mouseenter" + EVENT_KEY,
    MOUSELEAVE: "mouseleave" + EVENT_KEY,
    TOUCHEND: "touchend" + EVENT_KEY,
    LOAD_DATA_API: "load" + EVENT_KEY + DATA_API_KEY,
    CLICK_DATA_API: "click" + EVENT_KEY + DATA_API_KEY
fat's avatar
fat committed
59
60
61
62
63
  };
  var ClassName = {
    CAROUSEL: 'carousel',
    ACTIVE: 'active',
    SLIDE: 'slide',
Mark Otto's avatar
grunt    
Mark Otto committed
64
65
66
67
    RIGHT: 'carousel-item-right',
    LEFT: 'carousel-item-left',
    NEXT: 'carousel-item-next',
    PREV: 'carousel-item-prev',
fat's avatar
fat committed
68
69
70
71
72
73
    ITEM: 'carousel-item'
  };
  var Selector = {
    ACTIVE: '.active',
    ACTIVE_ITEM: '.active.carousel-item',
    ITEM: '.carousel-item',
Mark Otto's avatar
grunt    
Mark Otto committed
74
    NEXT_PREV: '.carousel-item-next, .carousel-item-prev',
fat's avatar
fat committed
75
76
77
    INDICATORS: '.carousel-indicators',
    DATA_SLIDE: '[data-slide], [data-slide-to]',
    DATA_RIDE: '[data-ride="carousel"]'
Mark Otto's avatar
dist    
Mark Otto committed
78
79
80
81
82
    /**
     * ------------------------------------------------------------------------
     * Class Definition
     * ------------------------------------------------------------------------
     */
fat's avatar
fat committed
83

Mark Otto's avatar
dist    
Mark Otto committed
84
  };
fat's avatar
fat committed
85

Mark Otto's avatar
dist    
Mark Otto committed
86
87
88
89
  var Carousel =
  /*#__PURE__*/
  function () {
    function Carousel(element, config) {
fat's avatar
fat committed
90
91
92
93
94
      this._items = null;
      this._interval = null;
      this._activeElement = null;
      this._isPaused = false;
      this._isSliding = false;
Mark Otto's avatar
build    
Mark Otto committed
95
      this.touchTimeout = null;
fat's avatar
fat committed
96
      this._config = this._getConfig(config);
fat's avatar
fat committed
97
98
99
100
      this._element = $(element)[0];
      this._indicatorsElement = $(this._element).find(Selector.INDICATORS)[0];

      this._addEventListeners();
Mark Otto's avatar
dist    
Mark Otto committed
101
    } // getters
fat's avatar
fat committed
102

Jacob Thornton's avatar
Jacob Thornton committed
103

Mark Otto's avatar
dist    
Mark Otto committed
104
    var _proto = Carousel.prototype;
fat's avatar
fat committed
105

Mark Otto's avatar
dist    
Mark Otto committed
106
107
108
109
110
111
    // public
    _proto.next = function next() {
      if (!this._isSliding) {
        this._slide(Direction.NEXT);
      }
    };
fat's avatar
fat committed
112

Mark Otto's avatar
dist    
Mark Otto committed
113
114
115
116
117
118
119
    _proto.nextWhenVisible = function nextWhenVisible() {
      // Don't call next when the page isn't visible
      // or the carousel or its parent isn't visible
      if (!document.hidden && $(this._element).is(':visible') && $(this._element).css('visibility') !== 'hidden') {
        this.next();
      }
    };
Mark Otto's avatar
grunt    
Mark Otto committed
120

Mark Otto's avatar
dist    
Mark Otto committed
121
122
123
    _proto.prev = function prev() {
      if (!this._isSliding) {
        this._slide(Direction.PREV);
XhmikosR's avatar
XhmikosR committed
124
      }
Mark Otto's avatar
dist    
Mark Otto committed
125
126
127
128
129
    };

    _proto.pause = function pause(event) {
      if (!event) {
        this._isPaused = true;
fat's avatar
fat committed
130
      }
Mark Otto's avatar
dist    
Mark Otto committed
131
132
133
134

      if ($(this._element).find(Selector.NEXT_PREV)[0] && Util.supportsTransitionEnd()) {
        Util.triggerTransitionEnd(this._element);
        this.cycle(true);
Mark Otto's avatar
grunt    
Mark Otto committed
135
      }
fat's avatar
fat committed
136

Mark Otto's avatar
dist    
Mark Otto committed
137
138
139
140
141
142
143
144
      clearInterval(this._interval);
      this._interval = null;
    };

    _proto.cycle = function cycle(event) {
      if (!event) {
        this._isPaused = false;
      }
Mark Otto's avatar
grunt    
Mark Otto committed
145

Mark Otto's avatar
dist    
Mark Otto committed
146
      if (this._interval) {
fat's avatar
fat committed
147
148
149
150
        clearInterval(this._interval);
        this._interval = null;
      }

Mark Otto's avatar
dist    
Mark Otto committed
151
152
153
154
      if (this._config.interval && !this._isPaused) {
        this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval);
      }
    };
fat's avatar
fat committed
155

Mark Otto's avatar
dist    
Mark Otto committed
156
157
158
159
160
161
162
163
164
    _proto.to = function to(index) {
      var _this = this;

      this._activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0];

      var activeIndex = this._getItemIndex(this._activeElement);

      if (index > this._items.length - 1 || index < 0) {
        return;
Mark Otto's avatar
grunt    
Mark Otto committed
165
      }
fat's avatar
fat committed
166

Mark Otto's avatar
dist    
Mark Otto committed
167
168
169
170
171
172
      if (this._isSliding) {
        $(this._element).one(Event.SLID, function () {
          return _this.to(index);
        });
        return;
      }
fat's avatar
fat committed
173

Mark Otto's avatar
dist    
Mark Otto committed
174
175
176
177
178
      if (activeIndex === index) {
        this.pause();
        this.cycle();
        return;
      }
fat's avatar
fat committed
179

Mark Otto's avatar
dist    
Mark Otto committed
180
      var direction = index > activeIndex ? Direction.NEXT : Direction.PREV;
fat's avatar
fat committed
181

Mark Otto's avatar
dist    
Mark Otto committed
182
183
      this._slide(direction, this._items[index]);
    };
fat's avatar
fat committed
184

Mark Otto's avatar
dist    
Mark Otto committed
185
186
187
188
189
190
191
192
193
194
195
196
    _proto.dispose = function dispose() {
      $(this._element).off(EVENT_KEY);
      $.removeData(this._element, DATA_KEY);
      this._items = null;
      this._config = null;
      this._element = null;
      this._interval = null;
      this._isPaused = null;
      this._isSliding = null;
      this._activeElement = null;
      this._indicatorsElement = null;
    }; // private
fat's avatar
fat committed
197
198


Mark Otto's avatar
dist    
Mark Otto committed
199
200
201
202
203
    _proto._getConfig = function _getConfig(config) {
      config = $.extend({}, Default, config);
      Util.typeCheckConfig(NAME, config, DefaultType);
      return config;
    };
fat's avatar
fat committed
204

Mark Otto's avatar
dist    
Mark Otto committed
205
206
    _proto._addEventListeners = function _addEventListeners() {
      var _this2 = this;
Mark Otto's avatar
grunt    
Mark Otto committed
207

Mark Otto's avatar
dist    
Mark Otto committed
208
209
210
211
      if (this._config.keyboard) {
        $(this._element).on(Event.KEYDOWN, function (event) {
          return _this2._keydown(event);
        });
fat's avatar
fat committed
212
      }
fat's avatar
fat committed
213

Mark Otto's avatar
dist    
Mark Otto committed
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
      if (this._config.pause === 'hover') {
        $(this._element).on(Event.MOUSEENTER, function (event) {
          return _this2.pause(event);
        }).on(Event.MOUSELEAVE, function (event) {
          return _this2.cycle(event);
        });

        if ('ontouchstart' in document.documentElement) {
          // if it's a touch-enabled device, mouseenter/leave are fired as
          // part of the mouse compatibility events on first tap - the carousel
          // would stop cycling until user tapped out of it;
          // here, we listen for touchend, explicitly pause the carousel
          // (as if it's the second time we tap on it, mouseenter compat event
          // is NOT fired) and after a timeout (to allow for mouse compatibility
          // events to fire) we explicitly restart cycling
          $(this._element).on(Event.TOUCHEND, function () {
            _this2.pause();

            if (_this2.touchTimeout) {
              clearTimeout(_this2.touchTimeout);
            }
fat's avatar
fat committed
235

Mark Otto's avatar
dist    
Mark Otto committed
236
237
238
            _this2.touchTimeout = setTimeout(function (event) {
              return _this2.cycle(event);
            }, TOUCHEVENT_COMPAT_WAIT + _this2._config.interval);
Mark Otto's avatar
dist    
Mark Otto committed
239
240
          });
        }
fat's avatar
fat committed
241
      }
Mark Otto's avatar
dist    
Mark Otto committed
242
    };
Mark Otto's avatar
dist    
Mark Otto committed
243

Mark Otto's avatar
dist    
Mark Otto committed
244
245
246
    _proto._keydown = function _keydown(event) {
      if (/input|textarea/i.test(event.target.tagName)) {
        return;
Mark Otto's avatar
grunt    
Mark Otto committed
247
      }
fat's avatar
fat committed
248

Mark Otto's avatar
dist    
Mark Otto committed
249
250
251
252
253
      switch (event.which) {
        case ARROW_LEFT_KEYCODE:
          event.preventDefault();
          this.prev();
          break;
fat's avatar
fat committed
254

Mark Otto's avatar
dist    
Mark Otto committed
255
256
257
258
259
260
261
        case ARROW_RIGHT_KEYCODE:
          event.preventDefault();
          this.next();
          break;

        default:
          return;
Mark Otto's avatar
dist    
Mark Otto committed
262
      }
Mark Otto's avatar
dist    
Mark Otto committed
263
    };
fat's avatar
fat committed
264

Mark Otto's avatar
dist    
Mark Otto committed
265
266
267
268
    _proto._getItemIndex = function _getItemIndex(element) {
      this._items = $.makeArray($(element).parent().find(Selector.ITEM));
      return this._items.indexOf(element);
    };
fat's avatar
fat committed
269

Mark Otto's avatar
dist    
Mark Otto committed
270
271
272
    _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) {
      var isNextDirection = direction === Direction.NEXT;
      var isPrevDirection = direction === Direction.PREV;
Mark Otto's avatar
grunt    
Mark Otto committed
273

Mark Otto's avatar
dist    
Mark Otto committed
274
      var activeIndex = this._getItemIndex(activeElement);
Mark Otto's avatar
grunt    
Mark Otto committed
275

Mark Otto's avatar
dist    
Mark Otto committed
276
277
278
279
280
      var lastItemIndex = this._items.length - 1;
      var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex;

      if (isGoingToWrap && !this._config.wrap) {
        return activeElement;
fat's avatar
fat committed
281
282
      }

Mark Otto's avatar
dist    
Mark Otto committed
283
284
285
286
      var delta = direction === Direction.PREV ? -1 : 1;
      var itemIndex = (activeIndex + delta) % this._items.length;
      return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex];
    };
fat's avatar
fat committed
287

Mark Otto's avatar
dist    
Mark Otto committed
288
289
    _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) {
      var targetIndex = this._getItemIndex(relatedTarget);
fat's avatar
fat committed
290

Mark Otto's avatar
dist    
Mark Otto committed
291
      var fromIndex = this._getItemIndex($(this._element).find(Selector.ACTIVE_ITEM)[0]);
fat's avatar
fat committed
292

Mark Otto's avatar
dist    
Mark Otto committed
293
294
295
296
297
298
299
300
301
      var slideEvent = $.Event(Event.SLIDE, {
        relatedTarget: relatedTarget,
        direction: eventDirectionName,
        from: fromIndex,
        to: targetIndex
      });
      $(this._element).trigger(slideEvent);
      return slideEvent;
    };
fat's avatar
fat committed
302

Mark Otto's avatar
dist    
Mark Otto committed
303
304
305
    _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) {
      if (this._indicatorsElement) {
        $(this._indicatorsElement).find(Selector.ACTIVE).removeClass(ClassName.ACTIVE);
fat's avatar
fat committed
306

Mark Otto's avatar
dist    
Mark Otto committed
307
        var nextIndicator = this._indicatorsElement.children[this._getItemIndex(element)];
fat's avatar
fat committed
308

Mark Otto's avatar
dist    
Mark Otto committed
309
310
311
312
313
        if (nextIndicator) {
          $(nextIndicator).addClass(ClassName.ACTIVE);
        }
      }
    };
fat's avatar
fat committed
314

Mark Otto's avatar
dist    
Mark Otto committed
315
316
    _proto._slide = function _slide(direction, element) {
      var _this3 = this;
fat's avatar
fat committed
317

Mark Otto's avatar
dist    
Mark Otto committed
318
      var activeElement = $(this._element).find(Selector.ACTIVE_ITEM)[0];
fat's avatar
fat committed
319

Mark Otto's avatar
dist    
Mark Otto committed
320
      var activeElementIndex = this._getItemIndex(activeElement);
fat's avatar
fat committed
321

Mark Otto's avatar
dist    
Mark Otto committed
322
      var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement);
fat's avatar
fat committed
323

Mark Otto's avatar
dist    
Mark Otto committed
324
      var nextElementIndex = this._getItemIndex(nextElement);
fat's avatar
fat committed
325

Mark Otto's avatar
dist    
Mark Otto committed
326
327
328
329
      var isCycling = Boolean(this._interval);
      var directionalClassName;
      var orderClassName;
      var eventDirectionName;
fat's avatar
fat committed
330

Mark Otto's avatar
dist    
Mark Otto committed
331
332
333
334
335
336
337
338
339
      if (direction === Direction.NEXT) {
        directionalClassName = ClassName.LEFT;
        orderClassName = ClassName.NEXT;
        eventDirectionName = Direction.LEFT;
      } else {
        directionalClassName = ClassName.RIGHT;
        orderClassName = ClassName.PREV;
        eventDirectionName = Direction.RIGHT;
      }
fat's avatar
fat committed
340

Mark Otto's avatar
dist    
Mark Otto committed
341
342
343
344
      if (nextElement && $(nextElement).hasClass(ClassName.ACTIVE)) {
        this._isSliding = false;
        return;
      }
fat's avatar
fat committed
345

Mark Otto's avatar
dist    
Mark Otto committed
346
      var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName);
fat's avatar
fat committed
347

Mark Otto's avatar
dist    
Mark Otto committed
348
349
      if (slideEvent.isDefaultPrevented()) {
        return;
Mark Otto's avatar
grunt    
Mark Otto committed
350
      }
fat's avatar
fat committed
351

Mark Otto's avatar
dist    
Mark Otto committed
352
353
354
355
      if (!activeElement || !nextElement) {
        // some weirdness is happening, so we bail
        return;
      }
fat's avatar
fat committed
356

Mark Otto's avatar
dist    
Mark Otto committed
357
      this._isSliding = true;
fat's avatar
fat committed
358

Mark Otto's avatar
dist    
Mark Otto committed
359
360
361
      if (isCycling) {
        this.pause();
      }
fat's avatar
fat committed
362

Mark Otto's avatar
dist    
Mark Otto committed
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
      this._setActiveIndicatorElement(nextElement);

      var slidEvent = $.Event(Event.SLID, {
        relatedTarget: nextElement,
        direction: eventDirectionName,
        from: activeElementIndex,
        to: nextElementIndex
      });

      if (Util.supportsTransitionEnd() && $(this._element).hasClass(ClassName.SLIDE)) {
        $(nextElement).addClass(orderClassName);
        Util.reflow(nextElement);
        $(activeElement).addClass(directionalClassName);
        $(nextElement).addClass(directionalClassName);
        $(activeElement).one(Util.TRANSITION_END, function () {
          $(nextElement).removeClass(directionalClassName + " " + orderClassName).addClass(ClassName.ACTIVE);
          $(activeElement).removeClass(ClassName.ACTIVE + " " + orderClassName + " " + directionalClassName);
          _this3._isSliding = false;
          setTimeout(function () {
            return $(_this3._element).trigger(slidEvent);
          }, 0);
        }).emulateTransitionEnd(TRANSITION_DURATION);
      } else {
        $(activeElement).removeClass(ClassName.ACTIVE);
        $(nextElement).addClass(ClassName.ACTIVE);
        this._isSliding = false;
        $(this._element).trigger(slidEvent);
      }
fat's avatar
fat committed
391

Mark Otto's avatar
dist    
Mark Otto committed
392
393
      if (isCycling) {
        this.cycle();
Mark Otto's avatar
grunt    
Mark Otto committed
394
      }
Mark Otto's avatar
dist    
Mark Otto committed
395
    }; // static
fat's avatar
fat committed
396

Mark Otto's avatar
Mark Otto committed
397

Mark Otto's avatar
dist    
Mark Otto committed
398
399
400
    Carousel._jQueryInterface = function _jQueryInterface(config) {
      return this.each(function () {
        var data = $(this).data(DATA_KEY);
fat's avatar
fat committed
401

Mark Otto's avatar
dist    
Mark Otto committed
402
403
404
405
        var _config = $.extend({}, Default, $(this).data());

        if (typeof config === 'object') {
          $.extend(_config, config);
Mark Otto's avatar
dist    
Mark Otto committed
406
        }
fat's avatar
fat committed
407

Mark Otto's avatar
dist    
Mark Otto committed
408
        var action = typeof config === 'string' ? config : _config.slide;
fat's avatar
fat committed
409

Mark Otto's avatar
dist    
Mark Otto committed
410
411
412
        if (!data) {
          data = new Carousel(this, _config);
          $(this).data(DATA_KEY, data);
Mark Otto's avatar
dist    
Mark Otto committed
413
        }
Mark Otto's avatar
grunt    
Mark Otto committed
414

Mark Otto's avatar
dist    
Mark Otto committed
415
416
417
418
419
420
        if (typeof config === 'number') {
          data.to(config);
        } else if (typeof action === 'string') {
          if (typeof data[action] === 'undefined') {
            throw new Error("No method named \"" + action + "\"");
          }
Mark Otto's avatar
grunt    
Mark Otto committed
421

Mark Otto's avatar
dist    
Mark Otto committed
422
423
424
425
          data[action]();
        } else if (_config.interval) {
          data.pause();
          data.cycle();
Mark Otto's avatar
dist    
Mark Otto committed
426
        }
Mark Otto's avatar
dist    
Mark Otto committed
427
428
      });
    };
Mark Otto's avatar
grunt    
Mark Otto committed
429

Mark Otto's avatar
dist    
Mark Otto committed
430
431
432
433
434
    Carousel._dataApiClickHandler = function _dataApiClickHandler(event) {
      var selector = Util.getSelectorFromElement(this);

      if (!selector) {
        return;
Mark Otto's avatar
dist    
Mark Otto committed
435
      }
Mark Otto's avatar
dist    
Mark Otto committed
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460

      var target = $(selector)[0];

      if (!target || !$(target).hasClass(ClassName.CAROUSEL)) {
        return;
      }

      var config = $.extend({}, $(target).data(), $(this).data());
      var slideIndex = this.getAttribute('data-slide-to');

      if (slideIndex) {
        config.interval = false;
      }

      Carousel._jQueryInterface.call($(target), config);

      if (slideIndex) {
        $(target).data(DATA_KEY).to(slideIndex);
      }

      event.preventDefault();
    };

    _createClass(Carousel, null, [{
      key: "VERSION",
Jacob Thornton's avatar
Jacob Thornton committed
461
462
463
464
      get: function get() {
        return VERSION;
      }
    }, {
Mark Otto's avatar
dist    
Mark Otto committed
465
      key: "Default",
Jacob Thornton's avatar
Jacob Thornton committed
466
467
468
      get: function get() {
        return Default;
      }
fat's avatar
fat committed
469
470
471
    }]);

    return Carousel;
Mark Otto's avatar
grunt    
Mark Otto committed
472
473
474
475
476
477
  }();
  /**
   * ------------------------------------------------------------------------
   * Data Api implementation
   * ------------------------------------------------------------------------
   */
fat's avatar
fat committed
478
479


Mark Otto's avatar
dist    
Mark Otto committed
480
  $(document).on(Event.CLICK_DATA_API, Selector.DATA_SLIDE, Carousel._dataApiClickHandler);
fat's avatar
fat committed
481
  $(window).on(Event.LOAD_DATA_API, function () {
fat's avatar
fat committed
482
483
    $(Selector.DATA_RIDE).each(function () {
      var $carousel = $(this);
Mark Otto's avatar
dist    
Mark Otto committed
484

fat's avatar
fat committed
485
486
      Carousel._jQueryInterface.call($carousel, $carousel.data());
    });
Mark Otto's avatar
Mark Otto committed
487
  });
fat's avatar
fat committed
488
489
490
491
492
493
  /**
   * ------------------------------------------------------------------------
   * jQuery
   * ------------------------------------------------------------------------
   */

Mark Otto's avatar
Mark Otto committed
494
  $.fn[NAME] = Carousel._jQueryInterface;
fat's avatar
fat committed
495
  $.fn[NAME].Constructor = Carousel;
Mark Otto's avatar
dist    
Mark Otto committed
496

fat's avatar
fat committed
497
498
499
500
501
502
  $.fn[NAME].noConflict = function () {
    $.fn[NAME] = JQUERY_NO_CONFLICT;
    return Carousel._jQueryInterface;
  };

  return Carousel;
Mark Otto's avatar
dist    
Mark Otto committed
503
}($);
Mark Otto's avatar
build    
Mark Otto committed
504
//# sourceMappingURL=carousel.js.map