fastman2 3.0.0-alpha.1 → 3.0.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/swiperoldman.js CHANGED
@@ -1,3005 +1 @@
1
- (function webpackUniversalModuleDefinition(root, factory) {
2
- if(typeof exports === 'object' && typeof module === 'object')
3
- module.exports = factory();
4
- else if(typeof define === 'function' && define.amd)
5
- define([], factory);
6
- else if(typeof exports === 'object')
7
- exports["fastman"] = factory();
8
- else
9
- root["fastman"] = factory();
10
- })(this, function() {
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
- /******/ // identity function for calling harmony imports with the correct context
47
- /******/ __webpack_require__.i = function(value) { return value; };
48
- /******/
49
- /******/ // define getter function for harmony exports
50
- /******/ __webpack_require__.d = function(exports, name, getter) {
51
- /******/ if(!__webpack_require__.o(exports, name)) {
52
- /******/ Object.defineProperty(exports, name, {
53
- /******/ configurable: false,
54
- /******/ enumerable: true,
55
- /******/ get: getter
56
- /******/ });
57
- /******/ }
58
- /******/ };
59
- /******/
60
- /******/ // getDefaultExport function for compatibility with non-harmony modules
61
- /******/ __webpack_require__.n = function(module) {
62
- /******/ var getter = module && module.__esModule ?
63
- /******/ function getDefault() { return module['default']; } :
64
- /******/ function getModuleExports() { return module; };
65
- /******/ __webpack_require__.d(getter, 'a', getter);
66
- /******/ return getter;
67
- /******/ };
68
- /******/
69
- /******/ // Object.prototype.hasOwnProperty.call
70
- /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
71
- /******/
72
- /******/ // __webpack_public_path__
73
- /******/ __webpack_require__.p = "";
74
- /******/
75
- /******/ // Load entry module and return exports
76
- /******/ return __webpack_require__(__webpack_require__.s = 21);
77
- /******/ })
78
- /************************************************************************/
79
- /******/ ({
80
-
81
- /***/ 0:
82
- /***/ (function(module, exports) {
83
-
84
- var g;
85
-
86
- // This works in non-strict mode
87
- g = (function() {
88
- return this;
89
- })();
90
-
91
- try {
92
- // This works if eval is allowed (see CSP)
93
- g = g || Function("return this")() || (1,eval)("this");
94
- } catch(e) {
95
- // This works if the window reference is available
96
- if(typeof window === "object")
97
- g = window;
98
- }
99
-
100
- // g can still be undefined, but nothing to do about it...
101
- // We return undefined, instead of nothing here, so it's
102
- // easier to handle this case. if(!global) { ...}
103
-
104
- module.exports = g;
105
-
106
-
107
- /***/ }),
108
-
109
- /***/ 16:
110
- /***/ (function(module, exports, __webpack_require__) {
111
-
112
- /* WEBPACK VAR INJECTION */(function(global) {module.exports = inViewport;
113
-
114
- var instances = [];
115
- var supportsMutationObserver = typeof global.MutationObserver === 'function';
116
-
117
- function inViewport(elt, params, cb) {
118
- var opts = {
119
- container: global.document.body,
120
- offset: 0,
121
- debounce: 15,
122
- failsafe: 150
123
- };
124
-
125
- if (params === undefined || typeof params === 'function') {
126
- cb = params;
127
- params = {};
128
- }
129
-
130
- var container = opts.container = params.container || opts.container;
131
- var offset = opts.offset = params.offset || opts.offset;
132
- var debounceValue = opts.debounce = params.debounce || opts.debounce;
133
- var failsafe = opts.failsafe = params.failsafe || opts.failsafe;
134
-
135
- // ensure backward compatibility with failsafe as boolean
136
- if (failsafe === true) {
137
- failsafe = 150;
138
- } else if(failsafe === false) {
139
- failsafe = 0;
140
- }
141
-
142
- // failsafe check always needs to be higher than debounceValue
143
- if (failsafe > 0 && failsafe < debounceValue) {
144
- failsafe = debounceValue + 50;
145
- }
146
-
147
- for (var i = 0; i < instances.length; i++) {
148
- if (
149
- instances[i].container === container &&
150
- instances[i]._debounce === debounceValue &&
151
- instances[i]._failsafe === failsafe
152
- ) {
153
- return instances[i].isInViewport(elt, offset, cb);
154
- }
155
- }
156
-
157
- return instances[
158
- instances.push(createInViewport(container, debounceValue, failsafe)) - 1
159
- ].isInViewport(elt, offset, cb);
160
- }
161
-
162
- function addEvent(el, type, fn) {
163
- if (el.attachEvent) {
164
- el.attachEvent('on' + type, fn);
165
- } else {
166
- el.addEventListener(type, fn, false);
167
- }
168
- }
169
-
170
- function debounce(func, wait, immediate) {
171
- var timeout;
172
- return function () {
173
- var context = this, args = arguments;
174
- var callNow = immediate && !timeout;
175
- clearTimeout(timeout);
176
- timeout = setTimeout(later, wait);
177
- if (callNow) func.apply(context, args);
178
-
179
- function later() {
180
- timeout = null;
181
- if (!immediate) func.apply(context, args);
182
- }
183
- };
184
- }
185
-
186
- // https://github.com/jquery/sizzle/blob/3136f48b90e3edc84cbaaa6f6f7734ef03775a07/sizzle.js#L708
187
- var contains = function() {
188
- if (!global.document) {
189
- return true;
190
- }
191
- return global.document.documentElement.compareDocumentPosition ?
192
- function (a, b) {
193
- return !!(a.compareDocumentPosition(b) & 16);
194
- } :
195
- global.document.documentElement.contains ?
196
- function (a, b) {
197
- return a !== b && ( a.contains ? a.contains(b) : false );
198
- } :
199
- function (a, b) {
200
- while (b = b.parentNode) {
201
- if (b === a) {
202
- return true;
203
- }
204
- }
205
- return false;
206
- };
207
- }
208
-
209
- function createInViewport(container, debounceValue, failsafe) {
210
- var watches = createWatches();
211
-
212
- var scrollContainer = container === global.document.body ? global : container;
213
- var debouncedCheck = debounce(watches.checkAll(watchInViewport), debounceValue);
214
-
215
- addEvent(scrollContainer, 'scroll', debouncedCheck);
216
-
217
- if (scrollContainer === global) {
218
- addEvent(global, 'resize', debouncedCheck);
219
- }
220
-
221
- if (supportsMutationObserver) {
222
- observeDOM(watches, container, debouncedCheck);
223
- }
224
-
225
- // failsafe check, every X we check for visible images
226
- // usecase: a hidden parent containing eleements
227
- // when the parent becomes visible, we have no event that the children
228
- // became visible
229
- if (failsafe > 0) {
230
- setInterval(debouncedCheck, failsafe);
231
- }
232
-
233
- function isInViewport(elt, offset, cb) {
234
- if (!cb) {
235
- return isVisible(elt, offset);
236
- }
237
-
238
- var remote = createRemote(elt, offset, cb);
239
- remote.watch();
240
- return remote;
241
- }
242
-
243
- function createRemote(elt, offset, cb) {
244
- function watch() {
245
- watches.add(elt, offset, cb);
246
- }
247
-
248
- function dispose() {
249
- watches.remove(elt);
250
- }
251
-
252
- return {
253
- watch: watch,
254
- dispose: dispose
255
- };
256
- }
257
-
258
- function watchInViewport(elt, offset, cb) {
259
- if (isVisible(elt, offset)) {
260
- watches.remove(elt);
261
- cb(elt);
262
- }
263
- }
264
-
265
- function isVisible(elt, offset) {
266
- if (!elt) {
267
- return false;
268
- }
269
-
270
- if (!contains(global.document.documentElement, elt) || !contains(global.document.documentElement, container)) {
271
- return false;
272
- }
273
-
274
- // Check if the element is visible
275
- // https://github.com/jquery/jquery/blob/740e190223d19a114d5373758127285d14d6b71e/src/css/hiddenVisibleSelectors.js
276
- if (!elt.offsetWidth || !elt.offsetHeight) {
277
- return false;
278
- }
279
-
280
- var eltRect = elt.getBoundingClientRect();
281
- var viewport = {};
282
-
283
- if (container === global.document.body) {
284
- viewport = {
285
- top: -offset,
286
- left: -offset,
287
- right: global.document.documentElement.clientWidth + offset,
288
- bottom: global.document.documentElement.clientHeight + offset
289
- };
290
- } else {
291
- var containerRect = container.getBoundingClientRect();
292
- viewport = {
293
- top: containerRect.top - offset,
294
- left: containerRect.left - offset,
295
- right: containerRect.right + offset,
296
- bottom: containerRect.bottom + offset
297
- };
298
- }
299
-
300
- // The element must overlap with the visible part of the viewport
301
- var visible =
302
- (
303
- eltRect.right >= viewport.left &&
304
- eltRect.left <= viewport.right &&
305
- eltRect.bottom >= viewport.top &&
306
- eltRect.top <= viewport.bottom
307
- );
308
-
309
- return visible;
310
- }
311
-
312
- return {
313
- container: container,
314
- isInViewport: isInViewport,
315
- _debounce: debounceValue,
316
- _failsafe: failsafe
317
- };
318
- }
319
-
320
- function createWatches() {
321
- var watches = [];
322
-
323
- function add(elt, offset, cb) {
324
- if (!isWatched(elt)) {
325
- watches.push([elt, offset, cb]);
326
- }
327
- }
328
-
329
- function remove(elt) {
330
- var pos = indexOf(elt);
331
- if (pos !== -1) {
332
- watches.splice(pos, 1);
333
- }
334
- }
335
-
336
- function indexOf(elt) {
337
- for (var i = watches.length - 1; i >= 0; i--) {
338
- if (watches[i][0] === elt) {
339
- return i;
340
- }
341
- }
342
- return -1;
343
- }
344
-
345
- function isWatched(elt) {
346
- return indexOf(elt) !== -1;
347
- }
348
-
349
- function checkAll(cb) {
350
- return function () {
351
- for (var i = watches.length - 1; i >= 0; i--) {
352
- cb.apply(this, watches[i]);
353
- }
354
- };
355
- }
356
-
357
- return {
358
- add: add,
359
- remove: remove,
360
- isWatched: isWatched,
361
- checkAll: checkAll
362
- };
363
- }
364
-
365
- function observeDOM(watches, container, cb) {
366
- var observer = new MutationObserver(watch);
367
- var filter = Array.prototype.filter;
368
- var concat = Array.prototype.concat;
369
-
370
- observer.observe(container, {
371
- childList: true,
372
- subtree: true,
373
- // changes like style/width/height/display will be catched
374
- attributes: true
375
- });
376
-
377
- function watch(mutations) {
378
- // some new DOM nodes where previously watched
379
- // we should check their positions
380
- if (mutations.some(knownNodes) === true) {
381
- setTimeout(cb, 0);
382
- }
383
- }
384
-
385
- function knownNodes(mutation) {
386
- var nodes = concat.call([],
387
- Array.prototype.slice.call(mutation.addedNodes),
388
- mutation.target
389
- );
390
- return filter.call(nodes, watches.isWatched).length > 0;
391
- }
392
- }
393
-
394
- /* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))
395
-
396
- /***/ }),
397
-
398
- /***/ 21:
399
- /***/ (function(module, exports, __webpack_require__) {
400
-
401
- "use strict";
402
-
403
-
404
- Object.defineProperty(exports, "__esModule", {
405
- value: true
406
- });
407
-
408
- var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
409
-
410
- var inViewport = __webpack_require__(16);
411
-
412
- var Swiper = function Swiper(container, params) {
413
- // if (!(this instanceof Swiper)) return new Swiper(container, params);
414
- var defaults = this.defaults;
415
- var initalVirtualTranslate = params && params.virtualTranslate;
416
-
417
- params = params || {};
418
- for (var def in defaults) {
419
- if (typeof params[def] === 'undefined') {
420
- params[def] = defaults[def];
421
- } else if (_typeof(params[def]) === 'object') {
422
- for (var deepDef in defaults[def]) {
423
- if (typeof params[def][deepDef] === 'undefined') {
424
- params[def][deepDef] = defaults[def][deepDef];
425
- }
426
- }
427
- }
428
- }
429
-
430
- // Swiper
431
- var s = this;
432
-
433
- // Params
434
- s.params = params;
435
-
436
- // Classname
437
- s.classNames = [];
438
-
439
- // Export it to Swiper instance
440
- s.$ = $;
441
- /*=========================
442
- Preparation - Define Container, Wrapper and Pagination
443
- ===========================*/
444
- s.container = $(container);
445
- if (s.container.length === 0) return;
446
- if (s.container.length > 1) {
447
- s.container.each(function () {
448
- new $.Swiper(this, params);
449
- });
450
- return;
451
- }
452
-
453
- // Save instance in container HTML Element and in data
454
- s.container[0].swiper = s;
455
- // 2017-06-13 使用zepto提供的dataset,不适用重写的dataset
456
- s.container.zeptoData('swiper', s);
457
-
458
- s.classNames.push('swiper-container-' + s.params.direction);
459
-
460
- if (s.params.freeMode) {
461
- s.classNames.push('swiper-container-free-mode');
462
- }
463
- if (!s.support.flexbox) {
464
- s.classNames.push('swiper-container-no-flexbox');
465
- s.params.slidesPerColumn = 1;
466
- }
467
- // Enable slides progress when required
468
- if (s.params.parallax || s.params.watchSlidesVisibility) {
469
- s.params.watchSlidesProgress = true;
470
- }
471
- // Coverflow / 3D
472
- if (['cube', 'coverflow'].indexOf(s.params.effect) >= 0) {
473
- if (s.support.transforms3d) {
474
- s.params.watchSlidesProgress = true;
475
- s.classNames.push('swiper-container-3d');
476
- } else {
477
- s.params.effect = 'slide';
478
- }
479
- }
480
- if (s.params.effect !== 'slide') {
481
- s.classNames.push('swiper-container-' + s.params.effect);
482
- }
483
- if (s.params.effect === 'cube') {
484
- s.params.resistanceRatio = 0;
485
- s.params.slidesPerView = 1;
486
- s.params.slidesPerColumn = 1;
487
- s.params.slidesPerGroup = 1;
488
- s.params.centeredSlides = false;
489
- s.params.spaceBetween = 0;
490
- s.params.virtualTranslate = true;
491
- s.params.setWrapperSize = false;
492
- }
493
- if (s.params.effect === 'fade') {
494
- s.params.slidesPerView = 1;
495
- s.params.slidesPerColumn = 1;
496
- s.params.slidesPerGroup = 1;
497
- s.params.watchSlidesProgress = true;
498
- s.params.spaceBetween = 0;
499
- if (typeof initalVirtualTranslate === 'undefined') {
500
- s.params.virtualTranslate = true;
501
- }
502
- }
503
-
504
- // Grab Cursor
505
- if (s.params.grabCursor && s.support.touch) {
506
- s.params.grabCursor = false;
507
- }
508
-
509
- // Wrapper
510
- s.wrapper = s.container.children('.' + s.params.wrapperClass);
511
-
512
- // Pagination
513
- if (s.params.pagination) {
514
- s.paginationContainer = $(s.params.pagination);
515
- if (s.params.paginationClickable) {
516
- s.paginationContainer.addClass('swiper-pagination-clickable');
517
- }
518
- }
519
-
520
- // Is Horizontal
521
- function isH() {
522
- return s.params.direction === 'horizontal';
523
- }
524
-
525
- // RTL
526
- s.rtl = isH() && (s.container[0].dir.toLowerCase() === 'rtl' || s.container.css('direction') === 'rtl');
527
- if (s.rtl) {
528
- s.classNames.push('swiper-container-rtl');
529
- }
530
-
531
- // Wrong RTL support
532
- if (s.rtl) {
533
- s.wrongRTL = s.wrapper.css('display') === '-webkit-box';
534
- }
535
-
536
- // Columns
537
- if (s.params.slidesPerColumn > 1) {
538
- s.classNames.push('swiper-container-multirow');
539
- }
540
-
541
- // Check for Android
542
- if (s.device.android) {
543
- s.classNames.push('swiper-container-android');
544
- }
545
-
546
- // Add classes
547
- s.container.addClass(s.classNames.join(' '));
548
-
549
- // Translate
550
- s.translate = 0;
551
-
552
- // Progress
553
- s.progress = 0;
554
-
555
- // Velocity
556
- s.velocity = 0;
557
-
558
- // Locks, unlocks
559
- s.lockSwipeToNext = function () {
560
- s.params.allowSwipeToNext = false;
561
- };
562
- s.lockSwipeToPrev = function () {
563
- s.params.allowSwipeToPrev = false;
564
- };
565
- s.lockSwipes = function () {
566
- s.params.allowSwipeToNext = s.params.allowSwipeToPrev = false;
567
- };
568
- s.unlockSwipeToNext = function () {
569
- s.params.allowSwipeToNext = true;
570
- };
571
- s.unlockSwipeToPrev = function () {
572
- s.params.allowSwipeToPrev = true;
573
- };
574
- s.unlockSwipes = function () {
575
- s.params.allowSwipeToNext = s.params.allowSwipeToPrev = true;
576
- };
577
-
578
- /*=========================
579
- Set grab cursor
580
- ===========================*/
581
- if (s.params.grabCursor) {
582
- s.container[0].style.cursor = 'move';
583
- s.container[0].style.cursor = '-webkit-grab';
584
- s.container[0].style.cursor = '-moz-grab';
585
- s.container[0].style.cursor = 'grab';
586
- }
587
- /*=========================
588
- Update on Images Ready
589
- ===========================*/
590
- s.imagesToLoad = [];
591
- s.imagesLoaded = 0;
592
-
593
- s.loadImage = function (imgElement, src, checkForComplete, callback) {
594
- var image;
595
- function onReady() {
596
- if (callback) callback();
597
- }
598
- if (!imgElement.complete || !checkForComplete) {
599
- if (src) {
600
- image = new Image();
601
- image.onload = onReady;
602
- image.onerror = onReady;
603
- image.src = src;
604
- } else {
605
- onReady();
606
- }
607
- } else {
608
- //image already loaded...
609
- onReady();
610
- }
611
- };
612
- s.preloadImages = function () {
613
- s.imagesToLoad = s.container.find('img');
614
- function _onReady() {
615
- if (typeof s === 'undefined' || s === null) return;
616
- if (s.imagesLoaded !== undefined) s.imagesLoaded++;
617
- if (s.imagesLoaded === s.imagesToLoad.length) {
618
- if (s.params.updateOnImagesReady) s.update();
619
- s.emit('onImagesReady', s);
620
- }
621
- }
622
- for (var i = 0; i < s.imagesToLoad.length; i++) {
623
- s.loadImage(s.imagesToLoad[i], s.imagesToLoad[i].currentSrc || s.imagesToLoad[i].getAttribute('src'), true, _onReady);
624
- }
625
- };
626
-
627
- /*=========================
628
- Autoplay
629
- ===========================*/
630
- s.autoplayTimeoutId = undefined;
631
- s.autoplaying = false;
632
- s.autoplayPaused = false;
633
- function autoplay() {
634
- s.autoplayTimeoutId = setTimeout(function () {
635
- if (s.params.loop) {
636
- s.fixLoop();
637
- s._slideNext();
638
- } else {
639
- if (!s.isEnd) {
640
- s._slideNext();
641
- } else {
642
- if (!params.autoplayStopOnLast) {
643
- s._slideTo(0);
644
- } else {
645
- s.stopAutoplay();
646
- }
647
- }
648
- }
649
- }, s.params.autoplay);
650
- }
651
- s.startAutoplay = function () {
652
- if (typeof s.autoplayTimeoutId !== 'undefined') return false;
653
- if (!s.params.autoplay) return false;
654
- if (s.autoplaying) return false;
655
- s.autoplaying = true;
656
- s.emit('onAutoplayStart', s);
657
- autoplay();
658
- };
659
- s.stopAutoplay = function () {
660
- if (!s.autoplayTimeoutId) return;
661
- if (s.autoplayTimeoutId) clearTimeout(s.autoplayTimeoutId);
662
- s.autoplaying = false;
663
- s.autoplayTimeoutId = undefined;
664
- s.emit('onAutoplayStop', s);
665
- };
666
- s.pauseAutoplay = function (speed) {
667
- if (s.autoplayPaused) return;
668
- if (s.autoplayTimeoutId) clearTimeout(s.autoplayTimeoutId);
669
- s.autoplayPaused = true;
670
- if (speed === 0) {
671
- s.autoplayPaused = false;
672
- autoplay();
673
- } else {
674
- s.wrapper.transitionEnd(function () {
675
- s.autoplayPaused = false;
676
- if (!s.autoplaying) {
677
- s.stopAutoplay();
678
- } else {
679
- autoplay();
680
- }
681
- });
682
- }
683
- };
684
- /*=========================
685
- Min/Max Translate
686
- ===========================*/
687
- s.minTranslate = function () {
688
- return -s.snapGrid[0];
689
- };
690
- s.maxTranslate = function () {
691
- return -s.snapGrid[s.snapGrid.length - 1];
692
- };
693
- /*=========================
694
- Slider/slides sizes
695
- ===========================*/
696
- s.updateContainerSize = function () {
697
- s.width = s.container[0].clientWidth;
698
- s.height = s.container[0].clientHeight;
699
- s.size = isH() ? s.width : s.height;
700
- };
701
-
702
- s.updateSlidesSize = function () {
703
- s.slides = s.wrapper.children('.' + s.params.slideClass);
704
- s.snapGrid = [];
705
- s.slidesGrid = [];
706
- s.slidesSizesGrid = [];
707
-
708
- var spaceBetween = s.params.spaceBetween,
709
- slidePosition = 0,
710
- i,
711
- prevSlideSize = 0,
712
- index = 0;
713
- if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) {
714
- spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * s.size;
715
- }
716
-
717
- s.virtualSize = -spaceBetween;
718
- // reset margins
719
- if (s.rtl) s.slides.css({ marginLeft: '', marginTop: '' });else s.slides.css({ marginRight: '', marginBottom: '' });
720
-
721
- var slidesNumberEvenToRows;
722
- if (s.params.slidesPerColumn > 1) {
723
- if (Math.floor(s.slides.length / s.params.slidesPerColumn) === s.slides.length / s.params.slidesPerColumn) {
724
- slidesNumberEvenToRows = s.slides.length;
725
- } else {
726
- slidesNumberEvenToRows = Math.ceil(s.slides.length / s.params.slidesPerColumn) * s.params.slidesPerColumn;
727
- }
728
- }
729
-
730
- // Calc slides
731
- var slideSize;
732
- for (i = 0; i < s.slides.length; i++) {
733
- slideSize = 0;
734
- var slide = s.slides.eq(i);
735
- if (s.params.slidesPerColumn > 1) {
736
- // Set slides order
737
- var newSlideOrderIndex;
738
- var column, row;
739
- var slidesPerColumn = s.params.slidesPerColumn;
740
- var slidesPerRow;
741
- if (s.params.slidesPerColumnFill === 'column') {
742
- column = Math.floor(i / slidesPerColumn);
743
- row = i - column * slidesPerColumn;
744
- newSlideOrderIndex = column + row * slidesNumberEvenToRows / slidesPerColumn;
745
- slide.css({
746
- '-webkit-box-ordinal-group': newSlideOrderIndex,
747
- '-moz-box-ordinal-group': newSlideOrderIndex,
748
- '-ms-flex-order': newSlideOrderIndex,
749
- '-webkit-order': newSlideOrderIndex,
750
- 'order': newSlideOrderIndex
751
- });
752
- } else {
753
- slidesPerRow = slidesNumberEvenToRows / slidesPerColumn;
754
- row = Math.floor(i / slidesPerRow);
755
- column = i - row * slidesPerRow;
756
- }
757
- slide.css({
758
- 'margin-top': row !== 0 && s.params.spaceBetween && s.params.spaceBetween + 'px'
759
- }).attr('data-swiper-column', column).attr('data-swiper-row', row);
760
- }
761
- if (slide.css('display') === 'none') continue;
762
- if (s.params.slidesPerView === 'auto') {
763
- slideSize = isH() ? slide.outerWidth(true) : slide.outerHeight(true);
764
- } else {
765
- slideSize = (s.size - (s.params.slidesPerView - 1) * spaceBetween) / s.params.slidesPerView;
766
- if (isH()) {
767
- s.slides[i].style.width = slideSize + 'px';
768
- } else {
769
- s.slides[i].style.height = slideSize + 'px';
770
- }
771
- }
772
- s.slides[i].swiperSlideSize = slideSize;
773
- s.slidesSizesGrid.push(slideSize);
774
-
775
- if (s.params.centeredSlides) {
776
- slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween;
777
- if (i === 0) slidePosition = slidePosition - s.size / 2 - spaceBetween;
778
- if (Math.abs(slidePosition) < 1 / 1000) slidePosition = 0;
779
- if (index % s.params.slidesPerGroup === 0) s.snapGrid.push(slidePosition);
780
- s.slidesGrid.push(slidePosition);
781
- } else {
782
- if (index % s.params.slidesPerGroup === 0) s.snapGrid.push(slidePosition);
783
- s.slidesGrid.push(slidePosition);
784
- slidePosition = slidePosition + slideSize + spaceBetween;
785
- }
786
-
787
- s.virtualSize += slideSize + spaceBetween;
788
-
789
- prevSlideSize = slideSize;
790
-
791
- index++;
792
- }
793
- s.virtualSize = Math.max(s.virtualSize, s.size);
794
-
795
- var newSlidesGrid;
796
-
797
- if (s.rtl && s.wrongRTL && (s.params.effect === 'slide' || s.params.effect === 'coverflow')) {
798
- s.wrapper.css({ width: s.virtualSize + s.params.spaceBetween + 'px' });
799
- }
800
- if (!s.support.flexbox || s.params.setWrapperSize) {
801
- if (isH()) s.wrapper.css({ width: s.virtualSize + s.params.spaceBetween + 'px' });else s.wrapper.css({ height: s.virtualSize + s.params.spaceBetween + 'px' });
802
- }
803
-
804
- if (s.params.slidesPerColumn > 1) {
805
- s.virtualSize = (slideSize + s.params.spaceBetween) * slidesNumberEvenToRows;
806
- s.virtualSize = Math.ceil(s.virtualSize / s.params.slidesPerColumn) - s.params.spaceBetween;
807
- s.wrapper.css({ width: s.virtualSize + s.params.spaceBetween + 'px' });
808
- if (s.params.centeredSlides) {
809
- newSlidesGrid = [];
810
- for (i = 0; i < s.snapGrid.length; i++) {
811
- if (s.snapGrid[i] < s.virtualSize + s.snapGrid[0]) newSlidesGrid.push(s.snapGrid[i]);
812
- }
813
- s.snapGrid = newSlidesGrid;
814
- }
815
- }
816
-
817
- // Remove last grid elements depending on width
818
- if (!s.params.centeredSlides) {
819
- newSlidesGrid = [];
820
- for (i = 0; i < s.snapGrid.length; i++) {
821
- if (s.snapGrid[i] <= s.virtualSize - s.size) {
822
- newSlidesGrid.push(s.snapGrid[i]);
823
- }
824
- }
825
- s.snapGrid = newSlidesGrid;
826
- if (Math.floor(s.virtualSize - s.size) > Math.floor(s.snapGrid[s.snapGrid.length - 1])) {
827
- s.snapGrid.push(s.virtualSize - s.size);
828
- }
829
- }
830
- if (s.snapGrid.length === 0) s.snapGrid = [0];
831
-
832
- if (s.params.spaceBetween !== 0) {
833
- if (isH()) {
834
- if (s.rtl) s.slides.css({ marginLeft: spaceBetween + 'px' });else s.slides.css({ marginRight: spaceBetween + 'px' });
835
- } else s.slides.css({ marginBottom: spaceBetween + 'px' });
836
- }
837
- if (s.params.watchSlidesProgress) {
838
- s.updateSlidesOffset();
839
- }
840
- };
841
- s.updateSlidesOffset = function () {
842
- for (var i = 0; i < s.slides.length; i++) {
843
- s.slides[i].swiperSlideOffset = isH() ? s.slides[i].offsetLeft : s.slides[i].offsetTop;
844
- }
845
- };
846
-
847
- /*=========================
848
- Slider/slides progress
849
- ===========================*/
850
- s.updateSlidesProgress = function (translate) {
851
- if (typeof translate === 'undefined') {
852
- translate = s.translate || 0;
853
- }
854
- if (s.slides.length === 0) return;
855
- if (typeof s.slides[0].swiperSlideOffset === 'undefined') s.updateSlidesOffset();
856
-
857
- var offsetCenter = s.params.centeredSlides ? -translate + s.size / 2 : -translate;
858
- if (s.rtl) offsetCenter = s.params.centeredSlides ? translate - s.size / 2 : translate;
859
-
860
- // Visible Slides
861
- s.slides.removeClass(s.params.slideVisibleClass);
862
- for (var i = 0; i < s.slides.length; i++) {
863
- var slide = s.slides[i];
864
- var slideCenterOffset = s.params.centeredSlides === true ? slide.swiperSlideSize / 2 : 0;
865
- var slideProgress = (offsetCenter - slide.swiperSlideOffset - slideCenterOffset) / (slide.swiperSlideSize + s.params.spaceBetween);
866
- if (s.params.watchSlidesVisibility) {
867
- var slideBefore = -(offsetCenter - slide.swiperSlideOffset - slideCenterOffset);
868
- var slideAfter = slideBefore + s.slidesSizesGrid[i];
869
- var isVisible = slideBefore >= 0 && slideBefore < s.size || slideAfter > 0 && slideAfter <= s.size || slideBefore <= 0 && slideAfter >= s.size;
870
- if (isVisible) {
871
- s.slides.eq(i).addClass(s.params.slideVisibleClass);
872
- }
873
- }
874
- slide.progress = s.rtl ? -slideProgress : slideProgress;
875
- }
876
- };
877
- s.updateProgress = function (translate) {
878
- if (typeof translate === 'undefined') {
879
- translate = s.translate || 0;
880
- }
881
- var translatesDiff = s.maxTranslate() - s.minTranslate();
882
- if (translatesDiff === 0) {
883
- s.progress = 0;
884
- s.isBeginning = s.isEnd = true;
885
- } else {
886
- s.progress = (translate - s.minTranslate()) / translatesDiff;
887
- s.isBeginning = s.progress <= 0;
888
- s.isEnd = s.progress >= 1;
889
- }
890
- if (s.isBeginning) s.emit('onReachBeginning', s);
891
- if (s.isEnd) s.emit('onReachEnd', s);
892
-
893
- if (s.params.watchSlidesProgress) s.updateSlidesProgress(translate);
894
- s.emit('onProgress', s, s.progress);
895
- };
896
- s.updateActiveIndex = function () {
897
- var translate = s.rtl ? s.translate : -s.translate;
898
- var newActiveIndex, i, snapIndex;
899
- for (i = 0; i < s.slidesGrid.length; i++) {
900
- if (typeof s.slidesGrid[i + 1] !== 'undefined') {
901
- if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1] - (s.slidesGrid[i + 1] - s.slidesGrid[i]) / 2) {
902
- newActiveIndex = i;
903
- } else if (translate >= s.slidesGrid[i] && translate < s.slidesGrid[i + 1]) {
904
- newActiveIndex = i + 1;
905
- }
906
- } else {
907
- if (translate >= s.slidesGrid[i]) {
908
- newActiveIndex = i;
909
- }
910
- }
911
- }
912
- // Normalize slideIndex
913
- if (newActiveIndex < 0 || typeof newActiveIndex === 'undefined') newActiveIndex = 0;
914
- // for (i = 0; i < s.slidesGrid.length; i++) {
915
- // if (- translate >= s.slidesGrid[i]) {
916
- // newActiveIndex = i;
917
- // }
918
- // }
919
- snapIndex = Math.floor(newActiveIndex / s.params.slidesPerGroup);
920
- if (snapIndex >= s.snapGrid.length) snapIndex = s.snapGrid.length - 1;
921
-
922
- if (newActiveIndex === s.activeIndex) {
923
- return;
924
- }
925
- s.snapIndex = snapIndex;
926
- s.previousIndex = s.activeIndex;
927
- s.activeIndex = newActiveIndex;
928
- s.updateClasses();
929
- };
930
-
931
- /*=========================
932
- Classes
933
- ===========================*/
934
- s.updateClasses = function () {
935
- s.slides.removeClass(s.params.slideActiveClass + ' ' + s.params.slideNextClass + ' ' + s.params.slidePrevClass);
936
- var activeSlide = s.slides.eq(s.activeIndex);
937
- // Active classes
938
- activeSlide.addClass(s.params.slideActiveClass);
939
- activeSlide.next('.' + s.params.slideClass).addClass(s.params.slideNextClass);
940
- activeSlide.prev('.' + s.params.slideClass).addClass(s.params.slidePrevClass);
941
-
942
- // Pagination
943
- if (s.bullets && s.bullets.length > 0) {
944
- s.bullets.removeClass(s.params.bulletActiveClass);
945
- var bulletIndex;
946
- if (s.params.loop) {
947
- bulletIndex = Math.ceil(s.activeIndex - s.loopedSlides) / s.params.slidesPerGroup;
948
- if (bulletIndex > s.slides.length - 1 - s.loopedSlides * 2) {
949
- bulletIndex = bulletIndex - (s.slides.length - s.loopedSlides * 2);
950
- }
951
- if (bulletIndex > s.bullets.length - 1) bulletIndex = bulletIndex - s.bullets.length;
952
- } else {
953
- if (typeof s.snapIndex !== 'undefined') {
954
- bulletIndex = s.snapIndex;
955
- } else {
956
- bulletIndex = s.activeIndex || 0;
957
- }
958
- }
959
- if (s.paginationContainer.length > 1) {
960
- s.bullets.each(function () {
961
- if ($(this).index() === bulletIndex) $(this).addClass(s.params.bulletActiveClass);
962
- });
963
- } else {
964
- s.bullets.eq(bulletIndex).addClass(s.params.bulletActiveClass);
965
- }
966
- }
967
-
968
- // Next/active buttons
969
- if (!s.params.loop) {
970
- if (s.params.prevButton) {
971
- if (s.isBeginning) {
972
- $(s.params.prevButton).addClass(s.params.buttonDisabledClass);
973
- if (s.params.a11y && s.a11y) s.a11y.disable($(s.params.prevButton));
974
- } else {
975
- $(s.params.prevButton).removeClass(s.params.buttonDisabledClass);
976
- if (s.params.a11y && s.a11y) s.a11y.enable($(s.params.prevButton));
977
- }
978
- }
979
- if (s.params.nextButton) {
980
- if (s.isEnd) {
981
- $(s.params.nextButton).addClass(s.params.buttonDisabledClass);
982
- if (s.params.a11y && s.a11y) s.a11y.disable($(s.params.nextButton));
983
- } else {
984
- $(s.params.nextButton).removeClass(s.params.buttonDisabledClass);
985
- if (s.params.a11y && s.a11y) s.a11y.enable($(s.params.nextButton));
986
- }
987
- }
988
- }
989
- };
990
-
991
- /*=========================
992
- Pagination
993
- ===========================*/
994
- s.updatePagination = function () {
995
- if (!s.params.pagination) return;
996
- if (s.paginationContainer && s.paginationContainer.length > 0) {
997
- var bulletsHTML = '';
998
- var numberOfBullets = s.params.loop ? Math.ceil((s.slides.length - s.loopedSlides * 2) / s.params.slidesPerGroup) : s.snapGrid.length;
999
- for (var i = 0; i < numberOfBullets; i++) {
1000
- if (s.params.paginationBulletRender) {
1001
- bulletsHTML += s.params.paginationBulletRender(i, s.params.bulletClass);
1002
- } else {
1003
- bulletsHTML += '<span class="' + s.params.bulletClass + '"></span>';
1004
- }
1005
- }
1006
- s.paginationContainer.html(bulletsHTML);
1007
- s.bullets = s.paginationContainer.find('.' + s.params.bulletClass);
1008
- }
1009
- };
1010
- /*=========================
1011
- Common update method
1012
- ===========================*/
1013
- s.update = function (updateTranslate) {
1014
- s.updateContainerSize();
1015
- s.updateSlidesSize();
1016
- s.updateProgress();
1017
- s.updatePagination();
1018
- s.updateClasses();
1019
- if (s.params.scrollbar && s.scrollbar) {
1020
- s.scrollbar.set();
1021
- }
1022
- function forceSetTranslate() {
1023
- newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());
1024
- s.setWrapperTranslate(newTranslate);
1025
- s.updateActiveIndex();
1026
- s.updateClasses();
1027
- }
1028
- if (updateTranslate) {
1029
- var translated, newTranslate;
1030
- if (s.params.freeMode) {
1031
- forceSetTranslate();
1032
- } else {
1033
- if (s.params.slidesPerView === 'auto' && s.isEnd && !s.params.centeredSlides) {
1034
- translated = s.slideTo(s.slides.length - 1, 0, false, true);
1035
- } else {
1036
- translated = s.slideTo(s.activeIndex, 0, false, true);
1037
- }
1038
- if (!translated) {
1039
- forceSetTranslate();
1040
- }
1041
- }
1042
- }
1043
- };
1044
-
1045
- /*=========================
1046
- Resize Handler
1047
- ===========================*/
1048
- s.onResize = function () {
1049
- s.updateContainerSize();
1050
- s.updateSlidesSize();
1051
- s.updateProgress();
1052
- if (s.params.slidesPerView === 'auto' || s.params.freeMode) s.updatePagination();
1053
- if (s.params.scrollbar && s.scrollbar) {
1054
- s.scrollbar.set();
1055
- }
1056
- if (s.params.freeMode) {
1057
- var newTranslate = Math.min(Math.max(s.translate, s.maxTranslate()), s.minTranslate());
1058
- s.setWrapperTranslate(newTranslate);
1059
- s.updateActiveIndex();
1060
- s.updateClasses();
1061
- } else {
1062
- s.updateClasses();
1063
- if (s.params.slidesPerView === 'auto' && s.isEnd && !s.params.centeredSlides) {
1064
- s.slideTo(s.slides.length - 1, 0, false, true);
1065
- } else {
1066
- s.slideTo(s.activeIndex, 0, false, true);
1067
- }
1068
- }
1069
- };
1070
-
1071
- /*=========================
1072
- Events
1073
- ===========================*/
1074
-
1075
- //Define Touch Events
1076
- var desktopEvents = ['mousedown', 'mousemove', 'mouseup'];
1077
- if (window.navigator.pointerEnabled) desktopEvents = ['pointerdown', 'pointermove', 'pointerup'];else if (window.navigator.msPointerEnabled) desktopEvents = ['MSPointerDown', 'MSPointerMove', 'MSPointerUp'];
1078
- s.touchEvents = {
1079
- start: s.support.touch || !s.params.simulateTouch ? 'touchstart' : desktopEvents[0],
1080
- move: s.support.touch || !s.params.simulateTouch ? 'touchmove' : desktopEvents[1],
1081
- end: s.support.touch || !s.params.simulateTouch ? 'touchend' : desktopEvents[2]
1082
- };
1083
-
1084
- // WP8 Touch Events Fix
1085
- if (window.navigator.pointerEnabled || window.navigator.msPointerEnabled) {
1086
- (s.params.touchEventsTarget === 'container' ? s.container : s.wrapper).addClass('swiper-wp8-' + s.params.direction);
1087
- }
1088
-
1089
- // Attach/detach events
1090
- s.initEvents = function (detach) {
1091
- var actionDom = detach ? 'off' : 'on';
1092
- var action = detach ? 'removeEventListener' : 'addEventListener';
1093
- var touchEventsTarget = s.params.touchEventsTarget === 'container' ? s.container[0] : s.wrapper[0];
1094
- var target = s.support.touch ? touchEventsTarget : document;
1095
-
1096
- var moveCapture = s.params.nested ? true : false;
1097
-
1098
- //Touch Events
1099
- if (s.browser.ie) {
1100
- touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, false);
1101
- target[action](s.touchEvents.move, s.onTouchMove, moveCapture);
1102
- target[action](s.touchEvents.end, s.onTouchEnd, false);
1103
- } else {
1104
- if (s.support.touch) {
1105
- touchEventsTarget[action](s.touchEvents.start, s.onTouchStart, false);
1106
- touchEventsTarget[action](s.touchEvents.move, s.onTouchMove, moveCapture);
1107
- touchEventsTarget[action](s.touchEvents.end, s.onTouchEnd, false);
1108
- }
1109
- if (params.simulateTouch && !s.device.ios && !s.device.android) {
1110
- touchEventsTarget[action]('mousedown', s.onTouchStart, false);
1111
- target[action]('mousemove', s.onTouchMove, moveCapture);
1112
- target[action]('mouseup', s.onTouchEnd, false);
1113
- }
1114
- }
1115
- window[action]('resize', s.onResize);
1116
-
1117
- // Next, Prev, Index
1118
- if (s.params.nextButton) {
1119
- $(s.params.nextButton)[actionDom]('click', s.onClickNext);
1120
- if (s.params.a11y && s.a11y) $(s.params.nextButton)[actionDom]('keydown', s.a11y.onEnterKey);
1121
- }
1122
- if (s.params.prevButton) {
1123
- $(s.params.prevButton)[actionDom]('click', s.onClickPrev);
1124
- if (s.params.a11y && s.a11y) $(s.params.prevButton)[actionDom]('keydown', s.a11y.onEnterKey);
1125
- }
1126
- if (s.params.pagination && s.params.paginationClickable) {
1127
- $(s.paginationContainer)[actionDom]('click', '.' + s.params.bulletClass, s.onClickIndex);
1128
- }
1129
-
1130
- // Prevent Links Clicks
1131
- if (s.params.preventClicks || s.params.preventClicksPropagation) touchEventsTarget[action]('click', s.preventClicks, true);
1132
- };
1133
- s.attachEvents = function () {
1134
- s.initEvents();
1135
- };
1136
- s.detachEvents = function () {
1137
- s.initEvents(true);
1138
- };
1139
-
1140
- /*=========================
1141
- Handle Clicks
1142
- ===========================*/
1143
- // Prevent Clicks
1144
- s.allowClick = true;
1145
- s.preventClicks = function (e) {
1146
- if (!s.allowClick) {
1147
- if (s.params.preventClicks) e.preventDefault();
1148
- if (s.params.preventClicksPropagation) {
1149
- e.stopPropagation();
1150
- e.stopImmediatePropagation();
1151
- }
1152
- }
1153
- };
1154
- // Clicks
1155
- s.onClickNext = function (e) {
1156
- e.preventDefault();
1157
- s.slideNext();
1158
- };
1159
- s.onClickPrev = function (e) {
1160
- e.preventDefault();
1161
- s.slidePrev();
1162
- };
1163
- s.onClickIndex = function (e) {
1164
- e.preventDefault();
1165
- var index = $(this).index() * s.params.slidesPerGroup;
1166
- if (s.params.loop) index = index + s.loopedSlides;
1167
- s.slideTo(index);
1168
- };
1169
-
1170
- /*=========================
1171
- Handle Touches
1172
- ===========================*/
1173
- function findElementInEvent(e, selector) {
1174
- var el = $(e.target);
1175
- if (!el.is(selector)) {
1176
- if (typeof selector === 'string') {
1177
- el = el.parents(selector);
1178
- } else if (selector.nodeType) {
1179
- var found;
1180
- el.parents().each(function (index, _el) {
1181
- if (_el === selector) found = selector;
1182
- });
1183
- if (!found) return undefined;else return selector;
1184
- }
1185
- }
1186
- if (el.length === 0) {
1187
- return undefined;
1188
- }
1189
- return el[0];
1190
- }
1191
- s.updateClickedSlide = function (e) {
1192
- var slide = findElementInEvent(e, '.' + s.params.slideClass);
1193
- if (slide) {
1194
- s.clickedSlide = slide;
1195
- s.clickedIndex = $(slide).index();
1196
- } else {
1197
- s.clickedSlide = undefined;
1198
- s.clickedIndex = undefined;
1199
- return;
1200
- }
1201
- if (s.params.slideToClickedSlide && s.clickedIndex !== undefined && s.clickedIndex !== s.activeIndex) {
1202
- var slideToIndex = s.clickedIndex,
1203
- realIndex;
1204
- if (s.params.loop) {
1205
- realIndex = $(s.clickedSlide).attr('data-swiper-slide-index');
1206
- if (slideToIndex > s.slides.length - s.params.slidesPerView) {
1207
- s.fixLoop();
1208
- slideToIndex = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index="' + realIndex + '"]').eq(0).index();
1209
- setTimeout(function () {
1210
- s.slideTo(slideToIndex);
1211
- }, 0);
1212
- } else if (slideToIndex < s.params.slidesPerView - 1) {
1213
- s.fixLoop();
1214
- var duplicatedSlides = s.wrapper.children('.' + s.params.slideClass + '[data-swiper-slide-index="' + realIndex + '"]');
1215
- slideToIndex = duplicatedSlides.eq(duplicatedSlides.length - 1).index();
1216
- setTimeout(function () {
1217
- s.slideTo(slideToIndex);
1218
- }, 0);
1219
- } else {
1220
- s.slideTo(slideToIndex);
1221
- }
1222
- } else {
1223
- s.slideTo(slideToIndex);
1224
- }
1225
- }
1226
- };
1227
-
1228
- var isTouched,
1229
- isMoved,
1230
- touchStartTime,
1231
- isScrolling,
1232
- currentTranslate,
1233
- startTranslate,
1234
- allowThresholdMove,
1235
-
1236
- // Form elements to match
1237
- formElements = 'input, select, textarea, button',
1238
-
1239
- // Last click time
1240
- lastClickTime = Date.now(),
1241
- clickTimeout,
1242
-
1243
- //Velocities
1244
- velocities = [],
1245
- allowMomentumBounce;
1246
-
1247
- // Animating Flag
1248
- s.animating = false;
1249
-
1250
- // Touches information
1251
- s.touches = {
1252
- startX: 0,
1253
- startY: 0,
1254
- currentX: 0,
1255
- currentY: 0,
1256
- diff: 0
1257
- };
1258
-
1259
- // Touch handlers
1260
- var isTouchEvent, startMoving;
1261
- s.onTouchStart = function (e) {
1262
- if (e.originalEvent) e = e.originalEvent;
1263
- isTouchEvent = e.type === 'touchstart';
1264
- if (!isTouchEvent && 'which' in e && e.which === 3) return;
1265
- if (s.params.noSwiping && findElementInEvent(e, '.' + s.params.noSwipingClass)) {
1266
- s.allowClick = true;
1267
- return;
1268
- }
1269
- if (s.params.swipeHandler) {
1270
- if (!findElementInEvent(e, s.params.swipeHandler)) return;
1271
- }
1272
- isTouched = true;
1273
- isMoved = false;
1274
- isScrolling = undefined;
1275
- startMoving = undefined;
1276
- s.touches.startX = s.touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX;
1277
- s.touches.startY = s.touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY;
1278
- touchStartTime = Date.now();
1279
- s.allowClick = true;
1280
- s.updateContainerSize();
1281
- s.swipeDirection = undefined;
1282
- if (s.params.threshold > 0) allowThresholdMove = false;
1283
- if (e.type !== 'touchstart') {
1284
- var preventDefault = true;
1285
- if ($(e.target).is(formElements)) preventDefault = false;
1286
- if (document.activeElement && $(document.activeElement).is(formElements)) {
1287
- document.activeElement.blur();
1288
- }
1289
- if (preventDefault) {
1290
- e.preventDefault();
1291
- }
1292
- }
1293
- s.emit('onTouchStart', s, e);
1294
- };
1295
-
1296
- s.onTouchMove = function (e) {
1297
- if (e.originalEvent) e = e.originalEvent;
1298
- if (isTouchEvent && e.type === 'mousemove') return;
1299
- if (e.preventedByNestedSwiper) return;
1300
- if (s.params.onlyExternal) {
1301
- isMoved = true;
1302
- s.allowClick = false;
1303
- return;
1304
- }
1305
- if (isTouchEvent && document.activeElement) {
1306
- if (e.target === document.activeElement && $(e.target).is(formElements)) {
1307
- isMoved = true;
1308
- s.allowClick = false;
1309
- return;
1310
- }
1311
- }
1312
-
1313
- s.emit('onTouchMove', s, e);
1314
-
1315
- if (e.targetTouches && e.targetTouches.length > 1) return;
1316
-
1317
- s.touches.currentX = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX;
1318
- s.touches.currentY = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY;
1319
-
1320
- if (typeof isScrolling === 'undefined') {
1321
- var touchAngle = Math.atan2(Math.abs(s.touches.currentY - s.touches.startY), Math.abs(s.touches.currentX - s.touches.startX)) * 180 / Math.PI;
1322
- isScrolling = isH() ? touchAngle > s.params.touchAngle : 90 - touchAngle > s.params.touchAngle;
1323
- }
1324
- if (isScrolling) {
1325
- s.emit('onTouchMoveOpposite', s, e);
1326
- }
1327
- if (typeof startMoving === 'undefined' && s.browser.ieTouch) {
1328
- if (s.touches.currentX !== s.touches.startX || s.touches.currentY !== s.touches.startY) {
1329
- startMoving = true;
1330
- }
1331
- }
1332
- if (!isTouched) return;
1333
- if (isScrolling) {
1334
- isTouched = false;
1335
- return;
1336
- }
1337
- if (!startMoving && s.browser.ieTouch) {
1338
- return;
1339
- }
1340
- s.allowClick = false;
1341
- s.emit('onSliderMove', s, e);
1342
- e.preventDefault();
1343
- if (s.params.touchMoveStopPropagation && !s.params.nested) {
1344
- e.stopPropagation();
1345
- }
1346
-
1347
- if (!isMoved) {
1348
- if (params.loop) {
1349
- s.fixLoop();
1350
- }
1351
- startTranslate = s.getWrapperTranslate();
1352
- s.setWrapperTransition(0);
1353
- if (s.animating) {
1354
- s.wrapper.trigger('webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd msTransitionEnd');
1355
- }
1356
- if (s.params.autoplay && s.autoplaying) {
1357
- if (s.params.autoplayDisableOnInteraction) {
1358
- s.stopAutoplay();
1359
- } else {
1360
- s.pauseAutoplay();
1361
- }
1362
- }
1363
- allowMomentumBounce = false;
1364
- //Grab Cursor
1365
- if (s.params.grabCursor) {
1366
- s.container[0].style.cursor = 'move';
1367
- s.container[0].style.cursor = '-webkit-grabbing';
1368
- s.container[0].style.cursor = '-moz-grabbin';
1369
- s.container[0].style.cursor = 'grabbing';
1370
- }
1371
- }
1372
- isMoved = true;
1373
-
1374
- var diff = s.touches.diff = isH() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;
1375
-
1376
- diff = diff * s.params.touchRatio;
1377
- if (s.rtl) diff = -diff;
1378
-
1379
- s.swipeDirection = diff > 0 ? 'prev' : 'next';
1380
- currentTranslate = diff + startTranslate;
1381
-
1382
- var disableParentSwiper = true;
1383
- if (diff > 0 && currentTranslate > s.minTranslate()) {
1384
- disableParentSwiper = false;
1385
- if (s.params.resistance) currentTranslate = s.minTranslate() - 1 + Math.pow(-s.minTranslate() + startTranslate + diff, s.params.resistanceRatio);
1386
- } else if (diff < 0 && currentTranslate < s.maxTranslate()) {
1387
- disableParentSwiper = false;
1388
- if (s.params.resistance) currentTranslate = s.maxTranslate() + 1 - Math.pow(s.maxTranslate() - startTranslate - diff, s.params.resistanceRatio);
1389
- }
1390
-
1391
- if (disableParentSwiper) {
1392
- e.preventedByNestedSwiper = true;
1393
- }
1394
-
1395
- // Directions locks
1396
- if (!s.params.allowSwipeToNext && s.swipeDirection === 'next' && currentTranslate < startTranslate) {
1397
- currentTranslate = startTranslate;
1398
- }
1399
- if (!s.params.allowSwipeToPrev && s.swipeDirection === 'prev' && currentTranslate > startTranslate) {
1400
- currentTranslate = startTranslate;
1401
- }
1402
-
1403
- if (!s.params.followFinger) return;
1404
-
1405
- // Threshold
1406
- if (s.params.threshold > 0) {
1407
- if (Math.abs(diff) > s.params.threshold || allowThresholdMove) {
1408
- if (!allowThresholdMove) {
1409
- allowThresholdMove = true;
1410
- s.touches.startX = s.touches.currentX;
1411
- s.touches.startY = s.touches.currentY;
1412
- currentTranslate = startTranslate;
1413
- s.touches.diff = isH() ? s.touches.currentX - s.touches.startX : s.touches.currentY - s.touches.startY;
1414
- return;
1415
- }
1416
- } else {
1417
- currentTranslate = startTranslate;
1418
- return;
1419
- }
1420
- }
1421
- // Update active index in free mode
1422
- if (s.params.freeMode || s.params.watchSlidesProgress) {
1423
- s.updateActiveIndex();
1424
- }
1425
- if (s.params.freeMode) {
1426
- //Velocity
1427
- if (velocities.length === 0) {
1428
- velocities.push({
1429
- position: s.touches[isH() ? 'startX' : 'startY'],
1430
- time: touchStartTime
1431
- });
1432
- }
1433
- velocities.push({
1434
- position: s.touches[isH() ? 'currentX' : 'currentY'],
1435
- time: new Date().getTime()
1436
- });
1437
- }
1438
- // Update progress
1439
- s.updateProgress(currentTranslate);
1440
- // Update translate
1441
- s.setWrapperTranslate(currentTranslate);
1442
- };
1443
- s.onTouchEnd = function (e) {
1444
- if (e.originalEvent) e = e.originalEvent;
1445
- s.emit('onTouchEnd', s, e);
1446
- if (!isTouched) return;
1447
- //Return Grab Cursor
1448
- if (s.params.grabCursor && isMoved && isTouched) {
1449
- s.container[0].style.cursor = 'move';
1450
- s.container[0].style.cursor = '-webkit-grab';
1451
- s.container[0].style.cursor = '-moz-grab';
1452
- s.container[0].style.cursor = 'grab';
1453
- }
1454
-
1455
- // Time diff
1456
- var touchEndTime = Date.now();
1457
- var timeDiff = touchEndTime - touchStartTime;
1458
-
1459
- // Tap, doubleTap, Click
1460
- if (s.allowClick) {
1461
- s.updateClickedSlide(e);
1462
- s.emit('onTap', s, e);
1463
- if (timeDiff < 300 && touchEndTime - lastClickTime > 300) {
1464
- if (clickTimeout) clearTimeout(clickTimeout);
1465
- clickTimeout = setTimeout(function () {
1466
- if (!s) return;
1467
- if (s.params.paginationHide && s.paginationContainer.length > 0 && !$(e.target).hasClass(s.params.bulletClass)) {
1468
- s.paginationContainer.toggleClass(s.params.paginationHiddenClass);
1469
- }
1470
- s.emit('onClick', s, e);
1471
- }, 300);
1472
- }
1473
- if (timeDiff < 300 && touchEndTime - lastClickTime < 300) {
1474
- if (clickTimeout) clearTimeout(clickTimeout);
1475
- s.emit('onDoubleTap', s, e);
1476
- }
1477
- }
1478
-
1479
- lastClickTime = Date.now();
1480
- setTimeout(function () {
1481
- if (s && s.allowClick) s.allowClick = true;
1482
- }, 0);
1483
-
1484
- if (!isTouched || !isMoved || !s.swipeDirection || s.touches.diff === 0 || currentTranslate === startTranslate) {
1485
- isTouched = isMoved = false;
1486
- return;
1487
- }
1488
- isTouched = isMoved = false;
1489
-
1490
- var currentPos;
1491
- if (s.params.followFinger) {
1492
- currentPos = s.rtl ? s.translate : -s.translate;
1493
- } else {
1494
- currentPos = -currentTranslate;
1495
- }
1496
- if (s.params.freeMode) {
1497
- if (currentPos < -s.minTranslate()) {
1498
- s.slideTo(s.activeIndex);
1499
- return;
1500
- } else if (currentPos > -s.maxTranslate()) {
1501
- s.slideTo(s.slides.length - 1);
1502
- return;
1503
- }
1504
-
1505
- if (s.params.freeModeMomentum) {
1506
- if (velocities.length > 1) {
1507
- var lastMoveEvent = velocities.pop(),
1508
- velocityEvent = velocities.pop();
1509
-
1510
- var distance = lastMoveEvent.position - velocityEvent.position;
1511
- var time = lastMoveEvent.time - velocityEvent.time;
1512
- s.velocity = distance / time;
1513
- s.velocity = s.velocity / 2;
1514
- if (Math.abs(s.velocity) < 0.02) {
1515
- s.velocity = 0;
1516
- }
1517
- // this implies that the user stopped moving a finger then released.
1518
- // There would be no events with distance zero, so the last event is stale.
1519
- if (time > 150 || new Date().getTime() - lastMoveEvent.time > 300) {
1520
- s.velocity = 0;
1521
- }
1522
- } else {
1523
- s.velocity = 0;
1524
- }
1525
-
1526
- velocities.length = 0;
1527
- var momentumDuration = 1000 * s.params.freeModeMomentumRatio;
1528
- var momentumDistance = s.velocity * momentumDuration;
1529
-
1530
- var newPosition = s.translate + momentumDistance;
1531
- if (s.rtl) newPosition = -newPosition;
1532
- var doBounce = false;
1533
- var afterBouncePosition;
1534
- var bounceAmount = Math.abs(s.velocity) * 20 * s.params.freeModeMomentumBounceRatio;
1535
- if (newPosition < s.maxTranslate()) {
1536
- if (s.params.freeModeMomentumBounce) {
1537
- if (newPosition + s.maxTranslate() < -bounceAmount) {
1538
- newPosition = s.maxTranslate() - bounceAmount;
1539
- }
1540
- afterBouncePosition = s.maxTranslate();
1541
- doBounce = true;
1542
- allowMomentumBounce = true;
1543
- } else {
1544
- newPosition = s.maxTranslate();
1545
- }
1546
- }
1547
- if (newPosition > s.minTranslate()) {
1548
- if (s.params.freeModeMomentumBounce) {
1549
- if (newPosition - s.minTranslate() > bounceAmount) {
1550
- newPosition = s.minTranslate() + bounceAmount;
1551
- }
1552
- afterBouncePosition = s.minTranslate();
1553
- doBounce = true;
1554
- allowMomentumBounce = true;
1555
- } else {
1556
- newPosition = s.minTranslate();
1557
- }
1558
- }
1559
- //Fix duration
1560
- if (s.velocity !== 0) {
1561
- if (s.rtl) {
1562
- momentumDuration = Math.abs((-newPosition - s.translate) / s.velocity);
1563
- } else {
1564
- momentumDuration = Math.abs((newPosition - s.translate) / s.velocity);
1565
- }
1566
- }
1567
-
1568
- if (s.params.freeModeMomentumBounce && doBounce) {
1569
- s.updateProgress(afterBouncePosition);
1570
- s.setWrapperTransition(momentumDuration);
1571
- s.setWrapperTranslate(newPosition);
1572
- s.onTransitionStart();
1573
- s.animating = true;
1574
- s.wrapper.transitionEnd(function () {
1575
- if (!allowMomentumBounce) return;
1576
- s.emit('onMomentumBounce', s);
1577
-
1578
- s.setWrapperTransition(s.params.speed);
1579
- s.setWrapperTranslate(afterBouncePosition);
1580
- s.wrapper.transitionEnd(function () {
1581
- s.onTransitionEnd();
1582
- });
1583
- });
1584
- } else if (s.velocity) {
1585
- s.updateProgress(newPosition);
1586
- s.setWrapperTransition(momentumDuration);
1587
- s.setWrapperTranslate(newPosition);
1588
- s.onTransitionStart();
1589
- if (!s.animating) {
1590
- s.animating = true;
1591
- s.wrapper.transitionEnd(function () {
1592
- s.onTransitionEnd();
1593
- });
1594
- }
1595
- } else {
1596
- s.updateProgress(newPosition);
1597
- }
1598
-
1599
- s.updateActiveIndex();
1600
- }
1601
- if (!s.params.freeModeMomentum || timeDiff >= s.params.longSwipesMs) {
1602
- s.updateProgress();
1603
- s.updateActiveIndex();
1604
- }
1605
- return;
1606
- }
1607
-
1608
- // Find current slide
1609
- var i,
1610
- stopIndex = 0,
1611
- groupSize = s.slidesSizesGrid[0];
1612
- for (i = 0; i < s.slidesGrid.length; i += s.params.slidesPerGroup) {
1613
- if (typeof s.slidesGrid[i + s.params.slidesPerGroup] !== 'undefined') {
1614
- if (currentPos >= s.slidesGrid[i] && currentPos < s.slidesGrid[i + s.params.slidesPerGroup]) {
1615
- stopIndex = i;
1616
- groupSize = s.slidesGrid[i + s.params.slidesPerGroup] - s.slidesGrid[i];
1617
- }
1618
- } else {
1619
- if (currentPos >= s.slidesGrid[i]) {
1620
- stopIndex = i;
1621
- groupSize = s.slidesGrid[s.slidesGrid.length - 1] - s.slidesGrid[s.slidesGrid.length - 2];
1622
- }
1623
- }
1624
- }
1625
-
1626
- // Find current slide size
1627
- var ratio = (currentPos - s.slidesGrid[stopIndex]) / groupSize;
1628
-
1629
- if (timeDiff > s.params.longSwipesMs) {
1630
- // Long touches
1631
- if (!s.params.longSwipes) {
1632
- s.slideTo(s.activeIndex);
1633
- return;
1634
- }
1635
- if (s.swipeDirection === 'next') {
1636
- if (ratio >= s.params.longSwipesRatio) s.slideTo(stopIndex + s.params.slidesPerGroup);else s.slideTo(stopIndex);
1637
- }
1638
- if (s.swipeDirection === 'prev') {
1639
- if (ratio > 1 - s.params.longSwipesRatio) s.slideTo(stopIndex + s.params.slidesPerGroup);else s.slideTo(stopIndex);
1640
- }
1641
- } else {
1642
- // Short swipes
1643
- if (!s.params.shortSwipes) {
1644
- s.slideTo(s.activeIndex);
1645
- return;
1646
- }
1647
- if (s.swipeDirection === 'next') {
1648
- s.slideTo(stopIndex + s.params.slidesPerGroup);
1649
- }
1650
- if (s.swipeDirection === 'prev') {
1651
- s.slideTo(stopIndex);
1652
- }
1653
- }
1654
- };
1655
- /*=========================
1656
- Transitions
1657
- ===========================*/
1658
- s._slideTo = function (slideIndex, speed) {
1659
- return s.slideTo(slideIndex, speed, true, true);
1660
- };
1661
- s.slideTo = function (slideIndex, speed, runCallbacks, internal) {
1662
- if (typeof runCallbacks === 'undefined') runCallbacks = true;
1663
- if (typeof slideIndex === 'undefined') slideIndex = 0;
1664
- if (slideIndex < 0) slideIndex = 0;
1665
- s.snapIndex = Math.floor(slideIndex / s.params.slidesPerGroup);
1666
- if (s.snapIndex >= s.snapGrid.length) s.snapIndex = s.snapGrid.length - 1;
1667
-
1668
- var translate = -s.snapGrid[s.snapIndex];
1669
-
1670
- // Stop autoplay
1671
-
1672
- if (s.params.autoplay && s.autoplaying) {
1673
- if (internal || !s.params.autoplayDisableOnInteraction) {
1674
- s.pauseAutoplay(speed);
1675
- } else {
1676
- s.stopAutoplay();
1677
- }
1678
- }
1679
- // Update progress
1680
- s.updateProgress(translate);
1681
-
1682
- // Normalize slideIndex
1683
- for (var i = 0; i < s.slidesGrid.length; i++) {
1684
- if (-translate >= s.slidesGrid[i]) {
1685
- slideIndex = i;
1686
- }
1687
- }
1688
-
1689
- if (typeof speed === 'undefined') speed = s.params.speed;
1690
- s.previousIndex = s.activeIndex || 0;
1691
- s.activeIndex = slideIndex;
1692
-
1693
- if (translate === s.translate) {
1694
- s.updateClasses();
1695
- return false;
1696
- }
1697
- s.updateClasses();
1698
- s.onTransitionStart(runCallbacks);
1699
- if (speed === 0) {
1700
- s.setWrapperTransition(0);
1701
- s.setWrapperTranslate(translate);
1702
- s.onTransitionEnd(runCallbacks);
1703
- } else {
1704
- s.setWrapperTransition(speed);
1705
- s.setWrapperTranslate(translate);
1706
- if (!s.animating) {
1707
- s.animating = true;
1708
- s.wrapper.transitionEnd(function () {
1709
- s.onTransitionEnd(runCallbacks);
1710
- });
1711
- }
1712
- }
1713
- // s.updateClasses();
1714
- return true;
1715
- };
1716
-
1717
- s.onTransitionStart = function (runCallbacks) {
1718
- if (typeof runCallbacks === 'undefined') runCallbacks = true;
1719
- if (s.lazy) s.lazy.onTransitionStart();
1720
- if (runCallbacks) {
1721
- s.emit('onTransitionStart', s);
1722
- if (s.activeIndex !== s.previousIndex) {
1723
- s.emit('onSlideChangeStart', s);
1724
- }
1725
- }
1726
- };
1727
- s.onTransitionEnd = function (runCallbacks) {
1728
- s.animating = false;
1729
- s.setWrapperTransition(0);
1730
- if (typeof runCallbacks === 'undefined') runCallbacks = true;
1731
- if (s.lazy) s.lazy.onTransitionEnd();
1732
- if (runCallbacks) {
1733
- s.emit('onTransitionEnd', s);
1734
- if (s.activeIndex !== s.previousIndex) {
1735
- s.emit('onSlideChangeEnd', s);
1736
- }
1737
- }
1738
- if (s.params.hashnav && s.hashnav) {
1739
- s.hashnav.setHash();
1740
- }
1741
- };
1742
- s.slideNext = function (runCallbacks, speed, internal) {
1743
- if (s.params.loop) {
1744
- if (s.animating) return false;
1745
- s.fixLoop();
1746
- return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);
1747
- } else return s.slideTo(s.activeIndex + s.params.slidesPerGroup, speed, runCallbacks, internal);
1748
- };
1749
- s._slideNext = function (speed) {
1750
- return s.slideNext(true, speed, true);
1751
- };
1752
- s.slidePrev = function (runCallbacks, speed, internal) {
1753
- if (s.params.loop) {
1754
- if (s.animating) return false;
1755
- s.fixLoop();
1756
- return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);
1757
- } else return s.slideTo(s.activeIndex - 1, speed, runCallbacks, internal);
1758
- };
1759
- s._slidePrev = function (speed) {
1760
- return s.slidePrev(true, speed, true);
1761
- };
1762
- s.slideReset = function (runCallbacks, speed) {
1763
- return s.slideTo(s.activeIndex, speed, runCallbacks);
1764
- };
1765
-
1766
- /*=========================
1767
- Translate/transition helpers
1768
- ===========================*/
1769
- s.setWrapperTransition = function (duration, byController) {
1770
- s.wrapper.transition(duration);
1771
- if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
1772
- s.effects[s.params.effect].setTransition(duration);
1773
- }
1774
- if (s.params.parallax && s.parallax) {
1775
- s.parallax.setTransition(duration);
1776
- }
1777
- if (s.params.scrollbar && s.scrollbar) {
1778
- s.scrollbar.setTransition(duration);
1779
- }
1780
- if (s.params.control && s.controller) {
1781
- s.controller.setTransition(duration, byController);
1782
- }
1783
- s.emit('onSetTransition', s, duration);
1784
- };
1785
- s.setWrapperTranslate = function (translate, updateActiveIndex, byController) {
1786
- var x = 0,
1787
- y = 0,
1788
- z = 0;
1789
- if (isH()) {
1790
- x = s.rtl ? -translate : translate;
1791
- } else {
1792
- y = translate;
1793
- }
1794
- if (!s.params.virtualTranslate) {
1795
- if (s.support.transforms3d) s.wrapper.transform('translate3d(' + x + 'px, ' + y + 'px, ' + z + 'px)');else s.wrapper.transform('translate(' + x + 'px, ' + y + 'px)');
1796
- }
1797
-
1798
- s.translate = isH() ? x : y;
1799
-
1800
- if (updateActiveIndex) s.updateActiveIndex();
1801
- if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
1802
- s.effects[s.params.effect].setTranslate(s.translate);
1803
- }
1804
- if (s.params.parallax && s.parallax) {
1805
- s.parallax.setTranslate(s.translate);
1806
- }
1807
- if (s.params.scrollbar && s.scrollbar) {
1808
- s.scrollbar.setTranslate(s.translate);
1809
- }
1810
- if (s.params.control && s.controller) {
1811
- s.controller.setTranslate(s.translate, byController);
1812
- }
1813
- s.emit('onSetTranslate', s, s.translate);
1814
- };
1815
-
1816
- s.getTranslate = function (el, axis) {
1817
- var matrix, curTransform, curStyle, transformMatrix;
1818
-
1819
- // automatic axis detection
1820
- if (typeof axis === 'undefined') {
1821
- axis = 'x';
1822
- }
1823
-
1824
- if (s.params.virtualTranslate) {
1825
- return s.rtl ? -s.translate : s.translate;
1826
- }
1827
-
1828
- curStyle = window.getComputedStyle(el, null);
1829
- if (window.WebKitCSSMatrix) {
1830
- // Some old versions of Webkit choke when 'none' is passed; pass
1831
- // empty string instead in this case
1832
- transformMatrix = new WebKitCSSMatrix(curStyle.webkitTransform === 'none' ? '' : curStyle.webkitTransform);
1833
- } else {
1834
- transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
1835
- matrix = transformMatrix.toString().split(',');
1836
- }
1837
-
1838
- if (axis === 'x') {
1839
- //Latest Chrome and webkits Fix
1840
- if (window.WebKitCSSMatrix) curTransform = transformMatrix.m41;
1841
- //Crazy IE10 Matrix
1842
- else if (matrix.length === 16) curTransform = parseFloat(matrix[12]);
1843
- //Normal Browsers
1844
- else curTransform = parseFloat(matrix[4]);
1845
- }
1846
- if (axis === 'y') {
1847
- //Latest Chrome and webkits Fix
1848
- if (window.WebKitCSSMatrix) curTransform = transformMatrix.m42;
1849
- //Crazy IE10 Matrix
1850
- else if (matrix.length === 16) curTransform = parseFloat(matrix[13]);
1851
- //Normal Browsers
1852
- else curTransform = parseFloat(matrix[5]);
1853
- }
1854
- if (s.rtl && curTransform) curTransform = -curTransform;
1855
- return curTransform || 0;
1856
- };
1857
- s.getWrapperTranslate = function (axis) {
1858
- if (typeof axis === 'undefined') {
1859
- axis = isH() ? 'x' : 'y';
1860
- }
1861
- return s.getTranslate(s.wrapper[0], axis);
1862
- };
1863
-
1864
- /*=========================
1865
- Observer
1866
- ===========================*/
1867
- s.observers = [];
1868
- function initObserver(target, options) {
1869
- options = options || {};
1870
- // create an observer instance
1871
- var ObserverFunc = window.MutationObserver || window.WebkitMutationObserver;
1872
- var observer = new ObserverFunc(function (mutations) {
1873
- mutations.forEach(function (mutation) {
1874
- s.onResize();
1875
- s.emit('onObserverUpdate', s, mutation);
1876
- });
1877
- });
1878
-
1879
- observer.observe(target, {
1880
- attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
1881
- childList: typeof options.childList === 'undefined' ? true : options.childList,
1882
- characterData: typeof options.characterData === 'undefined' ? true : options.characterData
1883
- });
1884
-
1885
- s.observers.push(observer);
1886
- }
1887
- s.initObservers = function () {
1888
- if (s.params.observeParents) {
1889
- var containerParents = s.container.parents();
1890
- for (var i = 0; i < containerParents.length; i++) {
1891
- initObserver(containerParents[i]);
1892
- }
1893
- }
1894
-
1895
- // Observe container
1896
- initObserver(s.container[0], { childList: false });
1897
-
1898
- // Observe wrapper
1899
- initObserver(s.wrapper[0], { attributes: false });
1900
- };
1901
- s.disconnectObservers = function () {
1902
- for (var i = 0; i < s.observers.length; i++) {
1903
- s.observers[i].disconnect();
1904
- }
1905
- s.observers = [];
1906
- };
1907
- /*=========================
1908
- Loop
1909
- ===========================*/
1910
- // Create looped slides
1911
- s.createLoop = function () {
1912
- // Remove duplicated slides
1913
- s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();
1914
-
1915
- var slides = s.wrapper.children('.' + s.params.slideClass);
1916
- s.loopedSlides = parseInt(s.params.loopedSlides || s.params.slidesPerView, 10);
1917
- s.loopedSlides = s.loopedSlides + s.params.loopAdditionalSlides;
1918
- if (s.loopedSlides > slides.length) {
1919
- s.loopedSlides = slides.length;
1920
- }
1921
-
1922
- var prependSlides = [],
1923
- appendSlides = [],
1924
- i;
1925
- slides.each(function (index, el) {
1926
- var slide = $(this);
1927
- if (index < s.loopedSlides) appendSlides.push(el);
1928
- if (index < slides.length && index >= slides.length - s.loopedSlides) prependSlides.push(el);
1929
- slide.attr('data-swiper-slide-index', index);
1930
- });
1931
- for (i = 0; i < appendSlides.length; i++) {
1932
- s.wrapper.append($(appendSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));
1933
- }
1934
- for (i = prependSlides.length - 1; i >= 0; i--) {
1935
- s.wrapper.prepend($(prependSlides[i].cloneNode(true)).addClass(s.params.slideDuplicateClass));
1936
- }
1937
- };
1938
- s.destroyLoop = function () {
1939
- s.wrapper.children('.' + s.params.slideClass + '.' + s.params.slideDuplicateClass).remove();
1940
- s.slides.removeAttr('data-swiper-slide-index');
1941
- };
1942
- s.fixLoop = function () {
1943
- var newIndex;
1944
- //Fix For Negative Oversliding
1945
- if (s.activeIndex < s.loopedSlides) {
1946
- newIndex = s.slides.length - s.loopedSlides * 3 + s.activeIndex;
1947
- newIndex = newIndex + s.loopedSlides;
1948
- s.slideTo(newIndex, 0, false, true);
1949
- }
1950
- //Fix For Positive Oversliding
1951
- else if (s.params.slidesPerView === 'auto' && s.activeIndex >= s.loopedSlides * 2 || s.activeIndex > s.slides.length - s.params.slidesPerView * 2) {
1952
- newIndex = -s.slides.length + s.activeIndex + s.loopedSlides;
1953
- newIndex = newIndex + s.loopedSlides;
1954
- s.slideTo(newIndex, 0, false, true);
1955
- }
1956
- };
1957
- /*=========================
1958
- Append/Prepend/Remove Slides
1959
- ===========================*/
1960
- s.appendSlide = function (slides) {
1961
- if (s.params.loop) {
1962
- s.destroyLoop();
1963
- }
1964
- if ((typeof slides === 'undefined' ? 'undefined' : _typeof(slides)) === 'object' && slides.length) {
1965
- for (var i = 0; i < slides.length; i++) {
1966
- if (slides[i]) s.wrapper.append(slides[i]);
1967
- }
1968
- } else {
1969
- s.wrapper.append(slides);
1970
- }
1971
- if (s.params.loop) {
1972
- s.createLoop();
1973
- }
1974
- if (!(s.params.observer && s.support.observer)) {
1975
- s.update(true);
1976
- }
1977
- };
1978
- s.prependSlide = function (slides) {
1979
- if (s.params.loop) {
1980
- s.destroyLoop();
1981
- }
1982
- var newActiveIndex = s.activeIndex + 1;
1983
- if ((typeof slides === 'undefined' ? 'undefined' : _typeof(slides)) === 'object' && slides.length) {
1984
- for (var i = 0; i < slides.length; i++) {
1985
- if (slides[i]) s.wrapper.prepend(slides[i]);
1986
- }
1987
- newActiveIndex = s.activeIndex + slides.length;
1988
- } else {
1989
- s.wrapper.prepend(slides);
1990
- }
1991
- if (s.params.loop) {
1992
- s.createLoop();
1993
- }
1994
- if (!(s.params.observer && s.support.observer)) {
1995
- s.update(true);
1996
- }
1997
- s.slideTo(newActiveIndex, 0, false);
1998
- };
1999
- s.removeSlide = function (slidesIndexes) {
2000
- if (s.params.loop) {
2001
- s.destroyLoop();
2002
- }
2003
- var newActiveIndex = s.activeIndex,
2004
- indexToRemove;
2005
- if ((typeof slidesIndexes === 'undefined' ? 'undefined' : _typeof(slidesIndexes)) === 'object' && slidesIndexes.length) {
2006
- for (var i = 0; i < slidesIndexes.length; i++) {
2007
- indexToRemove = slidesIndexes[i];
2008
- if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove();
2009
- if (indexToRemove < newActiveIndex) newActiveIndex--;
2010
- }
2011
- newActiveIndex = Math.max(newActiveIndex, 0);
2012
- } else {
2013
- indexToRemove = slidesIndexes;
2014
- if (s.slides[indexToRemove]) s.slides.eq(indexToRemove).remove();
2015
- if (indexToRemove < newActiveIndex) newActiveIndex--;
2016
- newActiveIndex = Math.max(newActiveIndex, 0);
2017
- }
2018
-
2019
- if (!(s.params.observer && s.support.observer)) {
2020
- s.update(true);
2021
- }
2022
- s.slideTo(newActiveIndex, 0, false);
2023
- };
2024
- s.removeAllSlides = function () {
2025
- var slidesIndexes = [];
2026
- for (var i = 0; i < s.slides.length; i++) {
2027
- slidesIndexes.push(i);
2028
- }
2029
- s.removeSlide(slidesIndexes);
2030
- };
2031
-
2032
- /*=========================
2033
- Effects
2034
- ===========================*/
2035
- s.effects = {
2036
- fade: {
2037
- fadeIndex: null,
2038
- setTranslate: function setTranslate() {
2039
- for (var i = 0; i < s.slides.length; i++) {
2040
- var slide = s.slides.eq(i);
2041
- var offset = slide[0].swiperSlideOffset;
2042
- var tx = -offset;
2043
- if (!s.params.virtualTranslate) tx = tx - s.translate;
2044
- var ty = 0;
2045
- if (!isH()) {
2046
- ty = tx;
2047
- tx = 0;
2048
- }
2049
- var slideOpacity = s.params.fade.crossFade ? Math.max(1 - Math.abs(slide[0].progress), 0) : 1 + Math.min(Math.max(slide[0].progress, -1), 0);
2050
- if (slideOpacity > 0 && slideOpacity < 1) {
2051
- s.effects.fade.fadeIndex = i;
2052
- }
2053
- slide.css({
2054
- opacity: slideOpacity
2055
- }).transform('translate3d(' + tx + 'px, ' + ty + 'px, 0px)');
2056
- }
2057
- },
2058
- setTransition: function setTransition(duration) {
2059
- s.slides.transition(duration);
2060
- if (s.params.virtualTranslate && duration !== 0) {
2061
- var fadeIndex = s.effects.fade.fadeIndex !== null ? s.effects.fade.fadeIndex : s.activeIndex;
2062
- s.slides.eq(fadeIndex).transitionEnd(function () {
2063
- var triggerEvents = ['webkitTransitionEnd', 'transitionend', 'oTransitionEnd', 'MSTransitionEnd', 'msTransitionEnd'];
2064
- for (var i = 0; i < triggerEvents.length; i++) {
2065
- s.wrapper.trigger(triggerEvents[i]);
2066
- }
2067
- });
2068
- }
2069
- }
2070
- },
2071
- cube: {
2072
- setTranslate: function setTranslate() {
2073
- var wrapperRotate = 0,
2074
- cubeShadow;
2075
- if (s.params.cube.shadow) {
2076
- if (isH()) {
2077
- cubeShadow = s.wrapper.find('.swiper-cube-shadow');
2078
- if (cubeShadow.length === 0) {
2079
- cubeShadow = $('<div class="swiper-cube-shadow"></div>');
2080
- s.wrapper.append(cubeShadow);
2081
- }
2082
- cubeShadow.css({ height: s.width + 'px' });
2083
- } else {
2084
- cubeShadow = s.container.find('.swiper-cube-shadow');
2085
- if (cubeShadow.length === 0) {
2086
- cubeShadow = $('<div class="swiper-cube-shadow"></div>');
2087
- s.container.append(cubeShadow);
2088
- }
2089
- }
2090
- }
2091
- for (var i = 0; i < s.slides.length; i++) {
2092
- var slide = s.slides.eq(i);
2093
- var slideAngle = i * 90;
2094
- var round = Math.floor(slideAngle / 360);
2095
- if (s.rtl) {
2096
- slideAngle = -slideAngle;
2097
- round = Math.floor(-slideAngle / 360);
2098
- }
2099
- var progress = Math.max(Math.min(slide[0].progress, 1), -1);
2100
- var tx = 0,
2101
- ty = 0,
2102
- tz = 0;
2103
- if (i % 4 === 0) {
2104
- tx = -round * 4 * s.size;
2105
- tz = 0;
2106
- } else if ((i - 1) % 4 === 0) {
2107
- tx = 0;
2108
- tz = -round * 4 * s.size;
2109
- } else if ((i - 2) % 4 === 0) {
2110
- tx = s.size + round * 4 * s.size;
2111
- tz = s.size;
2112
- } else if ((i - 3) % 4 === 0) {
2113
- tx = -s.size;
2114
- tz = 3 * s.size + s.size * 4 * round;
2115
- }
2116
- if (s.rtl) {
2117
- tx = -tx;
2118
- }
2119
-
2120
- if (!isH()) {
2121
- ty = tx;
2122
- tx = 0;
2123
- }
2124
-
2125
- var transform = 'rotateX(' + (isH() ? 0 : -slideAngle) + 'deg) rotateY(' + (isH() ? slideAngle : 0) + 'deg) translate3d(' + tx + 'px, ' + ty + 'px, ' + tz + 'px)';
2126
- if (progress <= 1 && progress > -1) {
2127
- wrapperRotate = i * 90 + progress * 90;
2128
- if (s.rtl) wrapperRotate = -i * 90 - progress * 90;
2129
- }
2130
- slide.transform(transform);
2131
- if (s.params.cube.slideShadows) {
2132
- //Set shadows
2133
- var shadowBefore = isH() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');
2134
- var shadowAfter = isH() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');
2135
- if (shadowBefore.length === 0) {
2136
- shadowBefore = $('<div class="swiper-slide-shadow-' + (isH() ? 'left' : 'top') + '"></div>');
2137
- slide.append(shadowBefore);
2138
- }
2139
- if (shadowAfter.length === 0) {
2140
- shadowAfter = $('<div class="swiper-slide-shadow-' + (isH() ? 'right' : 'bottom') + '"></div>');
2141
- slide.append(shadowAfter);
2142
- }
2143
- if (shadowBefore.length) shadowBefore[0].style.opacity = -slide[0].progress;
2144
- if (shadowAfter.length) shadowAfter[0].style.opacity = slide[0].progress;
2145
- }
2146
- }
2147
- s.wrapper.css({
2148
- '-webkit-transform-origin': '50% 50% -' + s.size / 2 + 'px',
2149
- '-moz-transform-origin': '50% 50% -' + s.size / 2 + 'px',
2150
- '-ms-transform-origin': '50% 50% -' + s.size / 2 + 'px',
2151
- 'transform-origin': '50% 50% -' + s.size / 2 + 'px'
2152
- });
2153
-
2154
- if (s.params.cube.shadow) {
2155
- if (isH()) {
2156
- cubeShadow.transform('translate3d(0px, ' + (s.width / 2 + s.params.cube.shadowOffset) + 'px, ' + -s.width / 2 + 'px) rotateX(90deg) rotateZ(0deg) scale(' + s.params.cube.shadowScale + ')');
2157
- } else {
2158
- var shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90;
2159
- var multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2);
2160
- var scale1 = s.params.cube.shadowScale,
2161
- scale2 = s.params.cube.shadowScale / multiplier,
2162
- offset = s.params.cube.shadowOffset;
2163
- cubeShadow.transform('scale3d(' + scale1 + ', 1, ' + scale2 + ') translate3d(0px, ' + (s.height / 2 + offset) + 'px, ' + -s.height / 2 / scale2 + 'px) rotateX(-90deg)');
2164
- }
2165
- }
2166
- var zFactor = s.isSafari || s.isUiWebView ? -s.size / 2 : 0;
2167
- s.wrapper.transform('translate3d(0px,0,' + zFactor + 'px) rotateX(' + (isH() ? 0 : wrapperRotate) + 'deg) rotateY(' + (isH() ? -wrapperRotate : 0) + 'deg)');
2168
- },
2169
- setTransition: function setTransition(duration) {
2170
- s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
2171
- if (s.params.cube.shadow && !isH()) {
2172
- s.container.find('.swiper-cube-shadow').transition(duration);
2173
- }
2174
- }
2175
- },
2176
- coverflow: {
2177
- setTranslate: function setTranslate() {
2178
- var transform = s.translate;
2179
- var center = isH() ? -transform + s.width / 2 : -transform + s.height / 2;
2180
- var rotate = isH() ? s.params.coverflow.rotate : -s.params.coverflow.rotate;
2181
- var translate = s.params.coverflow.depth;
2182
- //Each slide offset from center
2183
- for (var i = 0, length = s.slides.length; i < length; i++) {
2184
- var slide = s.slides.eq(i);
2185
- var slideSize = s.slidesSizesGrid[i];
2186
- var slideOffset = slide[0].swiperSlideOffset;
2187
- var offsetMultiplier = (center - slideOffset - slideSize / 2) / slideSize * s.params.coverflow.modifier;
2188
-
2189
- var rotateY = isH() ? rotate * offsetMultiplier : 0;
2190
- var rotateX = isH() ? 0 : rotate * offsetMultiplier;
2191
- // var rotateZ = 0
2192
- var translateZ = -translate * Math.abs(offsetMultiplier);
2193
-
2194
- var translateY = isH() ? 0 : s.params.coverflow.stretch * offsetMultiplier;
2195
- var translateX = isH() ? s.params.coverflow.stretch * offsetMultiplier : 0;
2196
-
2197
- //Fix for ultra small values
2198
- if (Math.abs(translateX) < 0.001) translateX = 0;
2199
- if (Math.abs(translateY) < 0.001) translateY = 0;
2200
- if (Math.abs(translateZ) < 0.001) translateZ = 0;
2201
- if (Math.abs(rotateY) < 0.001) rotateY = 0;
2202
- if (Math.abs(rotateX) < 0.001) rotateX = 0;
2203
-
2204
- var slideTransform = 'translate3d(' + translateX + 'px,' + translateY + 'px,' + translateZ + 'px) rotateX(' + rotateX + 'deg) rotateY(' + rotateY + 'deg)';
2205
-
2206
- slide.transform(slideTransform);
2207
- slide[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1;
2208
- if (s.params.coverflow.slideShadows) {
2209
- //Set shadows
2210
- var shadowBefore = isH() ? slide.find('.swiper-slide-shadow-left') : slide.find('.swiper-slide-shadow-top');
2211
- var shadowAfter = isH() ? slide.find('.swiper-slide-shadow-right') : slide.find('.swiper-slide-shadow-bottom');
2212
- if (shadowBefore.length === 0) {
2213
- shadowBefore = $('<div class="swiper-slide-shadow-' + (isH() ? 'left' : 'top') + '"></div>');
2214
- slide.append(shadowBefore);
2215
- }
2216
- if (shadowAfter.length === 0) {
2217
- shadowAfter = $('<div class="swiper-slide-shadow-' + (isH() ? 'right' : 'bottom') + '"></div>');
2218
- slide.append(shadowAfter);
2219
- }
2220
- if (shadowBefore.length) shadowBefore[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0;
2221
- if (shadowAfter.length) shadowAfter[0].style.opacity = -offsetMultiplier > 0 ? -offsetMultiplier : 0;
2222
- }
2223
- }
2224
-
2225
- //Set correct perspective for IE10
2226
- if (s.browser.ie) {
2227
- var ws = s.wrapper[0].style;
2228
- ws.perspectiveOrigin = center + 'px 50%';
2229
- }
2230
- },
2231
- setTransition: function setTransition(duration) {
2232
- s.slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration);
2233
- }
2234
- }
2235
- };
2236
-
2237
- /*=========================
2238
- Images Lazy Loading
2239
- ===========================*/
2240
- s.lazy = {
2241
- initialImageLoaded: false,
2242
- loadImageInSlide: function loadImageInSlide(index) {
2243
- if (typeof index === 'undefined') return;
2244
- if (s.slides.length === 0) return;
2245
-
2246
- var slide = s.slides.eq(index);
2247
- var img = slide.find('img.swiper-lazy:not(.swiper-lazy-loaded):not(.swiper-lazy-loading)');
2248
- if (img.length === 0) return;
2249
-
2250
- img.each(function () {
2251
- var _img = $(this);
2252
- _img.addClass('swiper-lazy-loading');
2253
-
2254
- var src = _img.attr('data-src');
2255
-
2256
- s.loadImage(_img[0], src, false, function () {
2257
- _img.attr('src', src);
2258
- _img.removeAttr('data-src');
2259
- _img.addClass('swiper-lazy-loaded').removeClass('swiper-lazy-loading');
2260
- // slide.find('.swiper-lazy-preloader, .preloader').remove();
2261
-
2262
- s.emit('onLazyImageReady', s, slide[0], _img[0]);
2263
- });
2264
-
2265
- s.emit('onLazyImageLoad', s, slide[0], _img[0]);
2266
- });
2267
- },
2268
- load: function load() {
2269
- if (s.params.watchSlidesVisibility) {
2270
- s.wrapper.children('.' + s.params.slideVisibleClass).each(function () {
2271
- s.lazy.loadImageInSlide($(this).index());
2272
- });
2273
- } else {
2274
- if (s.params.slidesPerView > 1) {
2275
- for (var i = s.activeIndex; i < s.activeIndex + s.params.slidesPerView; i++) {
2276
- if (s.slides[i]) s.lazy.loadImageInSlide(i);
2277
- }
2278
- } else {
2279
- s.lazy.loadImageInSlide(s.activeIndex);
2280
- }
2281
- }
2282
- if (s.params.lazyLoadingInPrevNext) {
2283
- var nextSlide = s.wrapper.children('.' + s.params.slideNextClass);
2284
- if (nextSlide.length > 0) s.lazy.loadImageInSlide(nextSlide.index());
2285
-
2286
- var prevSlide = s.wrapper.children('.' + s.params.slidePrevClass);
2287
- if (prevSlide.length > 0) s.lazy.loadImageInSlide(prevSlide.index());
2288
- }
2289
- },
2290
- onTransitionStart: function onTransitionStart() {
2291
- if (s.params.lazyLoading) {
2292
- if (s.params.lazyLoadingOnTransitionStart || !s.params.lazyLoadingOnTransitionStart && !s.lazy.initialImageLoaded) {
2293
- s.lazy.initialImageLoaded = true;
2294
- s.lazy.load();
2295
- }
2296
- }
2297
- },
2298
- onTransitionEnd: function onTransitionEnd() {
2299
- if (s.params.lazyLoading && !s.params.lazyLoadingOnTransitionStart) {
2300
- s.lazy.load();
2301
- }
2302
- }
2303
- };
2304
-
2305
- /*=========================
2306
- Scrollbar
2307
- ===========================*/
2308
- s.scrollbar = {
2309
- set: function set() {
2310
- if (!s.params.scrollbar) return;
2311
- var sb = s.scrollbar;
2312
- sb.track = $(s.params.scrollbar);
2313
- sb.drag = sb.track.find('.swiper-scrollbar-drag');
2314
- if (sb.drag.length === 0) {
2315
- sb.drag = $('<div class="swiper-scrollbar-drag"></div>');
2316
- sb.track.append(sb.drag);
2317
- }
2318
- sb.drag[0].style.width = '';
2319
- sb.drag[0].style.height = '';
2320
- sb.trackSize = isH() ? sb.track[0].offsetWidth : sb.track[0].offsetHeight;
2321
-
2322
- sb.divider = s.size / s.virtualSize;
2323
- sb.moveDivider = sb.divider * (sb.trackSize / s.size);
2324
- sb.dragSize = sb.trackSize * sb.divider;
2325
-
2326
- if (isH()) {
2327
- sb.drag[0].style.width = sb.dragSize + 'px';
2328
- } else {
2329
- sb.drag[0].style.height = sb.dragSize + 'px';
2330
- }
2331
-
2332
- if (sb.divider >= 1) {
2333
- sb.track[0].style.display = 'none';
2334
- } else {
2335
- sb.track[0].style.display = '';
2336
- }
2337
- if (s.params.scrollbarHide) {
2338
- sb.track[0].style.opacity = 0;
2339
- }
2340
- },
2341
- setTranslate: function setTranslate() {
2342
- if (!s.params.scrollbar) return;
2343
- var sb = s.scrollbar;
2344
- var newPos;
2345
-
2346
- var newSize = sb.dragSize;
2347
- newPos = (sb.trackSize - sb.dragSize) * s.progress;
2348
- if (s.rtl && isH()) {
2349
- newPos = -newPos;
2350
- if (newPos > 0) {
2351
- newSize = sb.dragSize - newPos;
2352
- newPos = 0;
2353
- } else if (-newPos + sb.dragSize > sb.trackSize) {
2354
- newSize = sb.trackSize + newPos;
2355
- }
2356
- } else {
2357
- if (newPos < 0) {
2358
- newSize = sb.dragSize + newPos;
2359
- newPos = 0;
2360
- } else if (newPos + sb.dragSize > sb.trackSize) {
2361
- newSize = sb.trackSize - newPos;
2362
- }
2363
- }
2364
- if (isH()) {
2365
- if (s.support.transforms3d) {
2366
- sb.drag.transform('translate3d(' + newPos + 'px, 0, 0)');
2367
- } else {
2368
- sb.drag.transform('translateX(' + newPos + 'px)');
2369
- }
2370
- sb.drag[0].style.width = newSize + 'px';
2371
- } else {
2372
- if (s.support.transforms3d) {
2373
- sb.drag.transform('translate3d(0px, ' + newPos + 'px, 0)');
2374
- } else {
2375
- sb.drag.transform('translateY(' + newPos + 'px)');
2376
- }
2377
- sb.drag[0].style.height = newSize + 'px';
2378
- }
2379
- if (s.params.scrollbarHide) {
2380
- clearTimeout(sb.timeout);
2381
- sb.track[0].style.opacity = 1;
2382
- sb.timeout = setTimeout(function () {
2383
- sb.track[0].style.opacity = 0;
2384
- sb.track.transition(400);
2385
- }, 1000);
2386
- }
2387
- },
2388
- setTransition: function setTransition(duration) {
2389
- if (!s.params.scrollbar) return;
2390
- s.scrollbar.drag.transition(duration);
2391
- }
2392
- };
2393
-
2394
- /*=========================
2395
- Controller
2396
- ===========================*/
2397
- s.controller = {
2398
- setTranslate: function setTranslate(translate, byController) {
2399
- var controlled = s.params.control;
2400
- var multiplier, controlledTranslate;
2401
- if (s.isArray(controlled)) {
2402
- for (var i = 0; i < controlled.length; i++) {
2403
- if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
2404
- translate = controlled[i].rtl && controlled[i].params.direction === 'horizontal' ? -s.translate : s.translate;
2405
- multiplier = (controlled[i].maxTranslate() - controlled[i].minTranslate()) / (s.maxTranslate() - s.minTranslate());
2406
- controlledTranslate = (translate - s.minTranslate()) * multiplier + controlled[i].minTranslate();
2407
- if (s.params.controlInverse) {
2408
- controlledTranslate = controlled[i].maxTranslate() - controlledTranslate;
2409
- }
2410
- controlled[i].updateProgress(controlledTranslate);
2411
- controlled[i].setWrapperTranslate(controlledTranslate, false, s);
2412
- controlled[i].updateActiveIndex();
2413
- }
2414
- }
2415
- } else if (controlled instanceof Swiper && byController !== controlled) {
2416
- translate = controlled.rtl && controlled.params.direction === 'horizontal' ? -s.translate : s.translate;
2417
- multiplier = (controlled.maxTranslate() - controlled.minTranslate()) / (s.maxTranslate() - s.minTranslate());
2418
- controlledTranslate = (translate - s.minTranslate()) * multiplier + controlled.minTranslate();
2419
- if (s.params.controlInverse) {
2420
- controlledTranslate = controlled.maxTranslate() - controlledTranslate;
2421
- }
2422
- controlled.updateProgress(controlledTranslate);
2423
- controlled.setWrapperTranslate(controlledTranslate, false, s);
2424
- controlled.updateActiveIndex();
2425
- }
2426
- },
2427
- setTransition: function setTransition(duration, byController) {
2428
- var controlled = s.params.control;
2429
- if (s.isArray(controlled)) {
2430
- for (var i = 0; i < controlled.length; i++) {
2431
- if (controlled[i] !== byController && controlled[i] instanceof Swiper) {
2432
- controlled[i].setWrapperTransition(duration, s);
2433
- }
2434
- }
2435
- } else if (controlled instanceof Swiper && byController !== controlled) {
2436
- controlled.setWrapperTransition(duration, s);
2437
- }
2438
- }
2439
- };
2440
-
2441
- /*=========================
2442
- Parallax
2443
- ===========================*/
2444
- function setParallaxTransform(el, progress) {
2445
- el = $(el);
2446
- var p, pX, pY;
2447
-
2448
- p = el.attr('data-swiper-parallax') || '0';
2449
- pX = el.attr('data-swiper-parallax-x');
2450
- pY = el.attr('data-swiper-parallax-y');
2451
- if (pX || pY) {
2452
- pX = pX || '0';
2453
- pY = pY || '0';
2454
- } else {
2455
- if (isH()) {
2456
- pX = p;
2457
- pY = '0';
2458
- } else {
2459
- pY = p;
2460
- pX = '0';
2461
- }
2462
- }
2463
- if (pX.indexOf('%') >= 0) {
2464
- pX = parseInt(pX, 10) * progress + '%';
2465
- } else {
2466
- pX = pX * progress + 'px';
2467
- }
2468
- if (pY.indexOf('%') >= 0) {
2469
- pY = parseInt(pY, 10) * progress + '%';
2470
- } else {
2471
- pY = pY * progress + 'px';
2472
- }
2473
- el.transform('translate3d(' + pX + ', ' + pY + ',0px)');
2474
- }
2475
- s.parallax = {
2476
- setTranslate: function setTranslate() {
2477
- s.container.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {
2478
- setParallaxTransform(this, s.progress);
2479
- });
2480
- s.slides.each(function () {
2481
- var slide = $(this);
2482
- slide.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {
2483
- var progress = Math.min(Math.max(slide[0].progress, -1), 1);
2484
- setParallaxTransform(this, progress);
2485
- });
2486
- });
2487
- },
2488
- setTransition: function setTransition(duration) {
2489
- if (typeof duration === 'undefined') duration = s.params.speed;
2490
- s.container.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]').each(function () {
2491
- var el = $(this);
2492
- var parallaxDuration = parseInt(el.attr('data-swiper-parallax-duration'), 10) || duration;
2493
- if (duration === 0) parallaxDuration = 0;
2494
- el.transition(parallaxDuration);
2495
- });
2496
- }
2497
- };
2498
-
2499
- /*=========================
2500
- Plugins API. Collect all and init all plugins
2501
- ===========================*/
2502
- s._plugins = [];
2503
- for (var plugin in s.plugins) {
2504
- if (s.plugins.hasOwnProperty(plugin)) {
2505
- var p = s.plugins[plugin](s, s.params[plugin]);
2506
- if (p) s._plugins.push(p);
2507
- }
2508
- }
2509
- // Method to call all plugins event/method
2510
- s.callPlugins = function (eventName) {
2511
- for (var i = 0; i < s._plugins.length; i++) {
2512
- if (eventName in s._plugins[i]) {
2513
- s._plugins[i][eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
2514
- }
2515
- }
2516
- };
2517
-
2518
- /*=========================
2519
- Events/Callbacks/Plugins Emitter
2520
- ===========================*/
2521
- function normalizeEventName(eventName) {
2522
- if (eventName.indexOf('on') !== 0) {
2523
- if (eventName[0] !== eventName[0].toUpperCase()) {
2524
- eventName = 'on' + eventName[0].toUpperCase() + eventName.substring(1);
2525
- } else {
2526
- eventName = 'on' + eventName;
2527
- }
2528
- }
2529
- return eventName;
2530
- }
2531
- s.emitterEventListeners = {};
2532
- s.emit = function (eventName) {
2533
- // Trigger callbacks
2534
- if (s.params[eventName]) {
2535
- s.params[eventName](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
2536
- }
2537
- var i;
2538
- // 图片浏览器点击关闭后,swiper也关闭了,但会执行到此处
2539
- if (!s) return;
2540
- // Trigger events
2541
- if (s.emitterEventListeners[eventName]) {
2542
- for (i = 0; i < s.emitterEventListeners[eventName].length; i++) {
2543
- s.emitterEventListeners[eventName][i](arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
2544
- }
2545
- }
2546
- // Trigger plugins
2547
- if (s.callPlugins) s.callPlugins(eventName, arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]);
2548
- };
2549
- s.on = function (eventName, handler) {
2550
- eventName = normalizeEventName(eventName);
2551
- if (!s.emitterEventListeners[eventName]) s.emitterEventListeners[eventName] = [];
2552
- s.emitterEventListeners[eventName].push(handler);
2553
- return s;
2554
- };
2555
- s.off = function (eventName, handler) {
2556
- var i;
2557
- eventName = normalizeEventName(eventName);
2558
- if (typeof handler === 'undefined') {
2559
- // Remove all handlers for such event
2560
- s.emitterEventListeners[eventName] = [];
2561
- return s;
2562
- }
2563
- if (!s.emitterEventListeners[eventName] || s.emitterEventListeners[eventName].length === 0) return;
2564
- for (i = 0; i < s.emitterEventListeners[eventName].length; i++) {
2565
- if (s.emitterEventListeners[eventName][i] === handler) s.emitterEventListeners[eventName].splice(i, 1);
2566
- }
2567
- return s;
2568
- };
2569
- s.once = function (eventName, handler) {
2570
- eventName = normalizeEventName(eventName);
2571
- var _handler = function _handler() {
2572
- handler(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]);
2573
- s.off(eventName, _handler);
2574
- };
2575
- s.on(eventName, _handler);
2576
- return s;
2577
- };
2578
-
2579
- // Accessibility tools
2580
- s.a11y = {
2581
- makeFocusable: function makeFocusable($el) {
2582
- $el[0].tabIndex = '0';
2583
- return $el;
2584
- },
2585
- addRole: function addRole($el, role) {
2586
- $el.attr('role', role);
2587
- return $el;
2588
- },
2589
-
2590
- addLabel: function addLabel($el, label) {
2591
- $el.attr('aria-label', label);
2592
- return $el;
2593
- },
2594
-
2595
- disable: function disable($el) {
2596
- $el.attr('aria-disabled', true);
2597
- return $el;
2598
- },
2599
-
2600
- enable: function enable($el) {
2601
- $el.attr('aria-disabled', false);
2602
- return $el;
2603
- },
2604
-
2605
- onEnterKey: function onEnterKey(event) {
2606
- if (event.keyCode !== 13) return;
2607
- if ($(event.target).is(s.params.nextButton)) {
2608
- s.onClickNext(event);
2609
- if (s.isEnd) {
2610
- s.a11y.notify(s.params.lastSlideMsg);
2611
- } else {
2612
- s.a11y.notify(s.params.nextSlideMsg);
2613
- }
2614
- } else if ($(event.target).is(s.params.prevButton)) {
2615
- s.onClickPrev(event);
2616
- if (s.isBeginning) {
2617
- s.a11y.notify(s.params.firstSlideMsg);
2618
- } else {
2619
- s.a11y.notify(s.params.prevSlideMsg);
2620
- }
2621
- }
2622
- },
2623
-
2624
- liveRegion: $('<span class="swiper-notification" aria-live="assertive" aria-atomic="true"></span>'),
2625
-
2626
- notify: function notify(message) {
2627
- var notification = s.a11y.liveRegion;
2628
- if (notification.length === 0) return;
2629
- notification.html('');
2630
- notification.html(message);
2631
- },
2632
- init: function init() {
2633
- // Setup accessibility
2634
- if (s.params.nextButton) {
2635
- var nextButton = $(s.params.nextButton);
2636
- s.a11y.makeFocusable(nextButton);
2637
- s.a11y.addRole(nextButton, 'button');
2638
- s.a11y.addLabel(nextButton, s.params.nextSlideMsg);
2639
- }
2640
- if (s.params.prevButton) {
2641
- var prevButton = $(s.params.prevButton);
2642
- s.a11y.makeFocusable(prevButton);
2643
- s.a11y.addRole(prevButton, 'button');
2644
- s.a11y.addLabel(prevButton, s.params.prevSlideMsg);
2645
- }
2646
-
2647
- $(s.container).append(s.a11y.liveRegion);
2648
- },
2649
- destroy: function destroy() {
2650
- if (s.a11y.liveRegion && s.a11y.liveRegion.length > 0) s.a11y.liveRegion.remove();
2651
- }
2652
- };
2653
-
2654
- /*=========================
2655
- Init/Destroy
2656
- ===========================*/
2657
- s.init = function () {
2658
- if (s.params.loop) s.createLoop();
2659
- s.updateContainerSize();
2660
- s.updateSlidesSize();
2661
- s.updatePagination();
2662
- if (s.params.scrollbar && s.scrollbar) {
2663
- s.scrollbar.set();
2664
- }
2665
- if (s.params.effect !== 'slide' && s.effects[s.params.effect]) {
2666
- if (!s.params.loop) s.updateProgress();
2667
- s.effects[s.params.effect].setTranslate();
2668
- }
2669
- if (s.params.loop) {
2670
- s.slideTo(s.params.initialSlide + s.loopedSlides, 0, s.params.runCallbacksOnInit);
2671
- } else {
2672
- s.slideTo(s.params.initialSlide, 0, s.params.runCallbacksOnInit);
2673
- if (s.params.initialSlide === 0) {
2674
- if (s.parallax && s.params.parallax) s.parallax.setTranslate();
2675
- if (s.lazy && s.params.lazyLoading) s.lazy.load();
2676
- }
2677
- }
2678
- s.attachEvents();
2679
- if (s.params.observer && s.support.observer) {
2680
- s.initObservers();
2681
- }
2682
- if (s.params.preloadImages && !s.params.lazyLoading) {
2683
- s.preloadImages();
2684
- }
2685
- if (s.params.autoplay) {
2686
- s.startAutoplay();
2687
- }
2688
- if (s.params.keyboardControl) {
2689
- if (s.enableKeyboardControl) s.enableKeyboardControl();
2690
- }
2691
- if (s.params.mousewheelControl) {
2692
- if (s.enableMousewheelControl) s.enableMousewheelControl();
2693
- }
2694
- if (s.params.hashnav) {
2695
- if (s.hashnav) s.hashnav.init();
2696
- }
2697
- if (s.params.a11y && s.a11y) s.a11y.init();
2698
- s.emit('onInit', s);
2699
- };
2700
-
2701
- // Cleanup dynamic styles
2702
- s.cleanupStyles = function () {
2703
- // Container
2704
- s.container.removeClass(s.classNames.join(' ')).removeAttr('style');
2705
-
2706
- // Wrapper
2707
- s.wrapper.removeAttr('style');
2708
-
2709
- // Slides
2710
- if (s.slides && s.slides.length) {
2711
- s.slides.removeClass([s.params.slideVisibleClass, s.params.slideActiveClass, s.params.slideNextClass, s.params.slidePrevClass].join(' ')).removeAttr('style').removeAttr('data-swiper-column').removeAttr('data-swiper-row');
2712
- }
2713
-
2714
- // Pagination/Bullets
2715
- if (s.paginationContainer && s.paginationContainer.length) {
2716
- s.paginationContainer.removeClass(s.params.paginationHiddenClass);
2717
- }
2718
- if (s.bullets && s.bullets.length) {
2719
- s.bullets.removeClass(s.params.bulletActiveClass);
2720
- }
2721
-
2722
- // Buttons
2723
- if (s.params.prevButton) $(s.params.prevButton).removeClass(s.params.buttonDisabledClass);
2724
- if (s.params.nextButton) $(s.params.nextButton).removeClass(s.params.buttonDisabledClass);
2725
-
2726
- // Scrollbar
2727
- if (s.params.scrollbar && s.scrollbar) {
2728
- if (s.scrollbar.track && s.scrollbar.track.length) s.scrollbar.track.removeAttr('style');
2729
- if (s.scrollbar.drag && s.scrollbar.drag.length) s.scrollbar.drag.removeAttr('style');
2730
- }
2731
- };
2732
-
2733
- // Destroy
2734
- s.destroy = function (deleteInstance, cleanupStyles) {
2735
- // Detach evebts
2736
- s.detachEvents();
2737
- // Stop autoplay
2738
- s.stopAutoplay();
2739
- // Destroy loop
2740
- if (s.params.loop) {
2741
- s.destroyLoop();
2742
- }
2743
- // Cleanup styles
2744
- if (cleanupStyles) {
2745
- s.cleanupStyles();
2746
- }
2747
- // Disconnect observer
2748
- s.disconnectObservers();
2749
- // Disable keyboard/mousewheel
2750
- if (s.params.keyboardControl) {
2751
- if (s.disableKeyboardControl) s.disableKeyboardControl();
2752
- }
2753
- if (s.params.mousewheelControl) {
2754
- if (s.disableMousewheelControl) s.disableMousewheelControl();
2755
- }
2756
- // Disable a11y
2757
- if (s.params.a11y && s.a11y) s.a11y.destroy();
2758
- // Destroy callback
2759
- s.emit('onDestroy');
2760
- // Delete instance
2761
- if (deleteInstance !== false) s = null;
2762
- };
2763
-
2764
- //加个最小高度为了能够触发in-viewport
2765
- s.container.css('min-height', '1px');
2766
- inViewport(s.container[0], visible);
2767
- function visible(elt) {
2768
- // console.log('swiper visible!');
2769
- s.init();
2770
- }
2771
-
2772
- // Return swiper instance
2773
- return s;
2774
- };
2775
- /*==================================================
2776
- Prototype
2777
- ====================================================*/
2778
- Swiper.prototype = {
2779
- defaults: {
2780
- direction: 'horizontal',
2781
- touchEventsTarget: 'container',
2782
- initialSlide: 0,
2783
- speed: 300,
2784
- // autoplay
2785
- autoplay: false,
2786
- autoplayDisableOnInteraction: true,
2787
- // Free mode
2788
- freeMode: false,
2789
- freeModeMomentum: true,
2790
- freeModeMomentumRatio: 1,
2791
- freeModeMomentumBounce: true,
2792
- freeModeMomentumBounceRatio: 1,
2793
- // Set wrapper width
2794
- setWrapperSize: false,
2795
- // Virtual Translate
2796
- virtualTranslate: false,
2797
- // Effects
2798
- effect: 'slide', // 'slide' or 'fade' or 'cube' or 'coverflow'
2799
- coverflow: {
2800
- rotate: 50,
2801
- stretch: 0,
2802
- depth: 100,
2803
- modifier: 1,
2804
- slideShadows: true
2805
- },
2806
- cube: {
2807
- slideShadows: true,
2808
- shadow: true,
2809
- shadowOffset: 20,
2810
- shadowScale: 0.94
2811
- },
2812
- fade: {
2813
- crossFade: false
2814
- },
2815
- // Parallax
2816
- parallax: false,
2817
- // Scrollbar
2818
- scrollbar: null,
2819
- scrollbarHide: true,
2820
- // Keyboard Mousewheel
2821
- keyboardControl: false,
2822
- mousewheelControl: false,
2823
- mousewheelForceToAxis: false,
2824
- // Hash Navigation
2825
- hashnav: false,
2826
- // Slides grid
2827
- spaceBetween: 0,
2828
- slidesPerView: 1,
2829
- slidesPerColumn: 1,
2830
- slidesPerColumnFill: 'column',
2831
- slidesPerGroup: 1,
2832
- centeredSlides: false,
2833
- // Touches
2834
- touchRatio: 1,
2835
- touchAngle: 45,
2836
- simulateTouch: true,
2837
- shortSwipes: true,
2838
- longSwipes: true,
2839
- longSwipesRatio: 0.5,
2840
- longSwipesMs: 300,
2841
- followFinger: true,
2842
- onlyExternal: false,
2843
- threshold: 0,
2844
- touchMoveStopPropagation: true,
2845
- // Pagination
2846
- pagination: null,
2847
- paginationClickable: false,
2848
- paginationHide: false,
2849
- paginationBulletRender: null,
2850
- // Resistance
2851
- resistance: true,
2852
- resistanceRatio: 0.85,
2853
- // Next/prev buttons
2854
- nextButton: null,
2855
- prevButton: null,
2856
- // Progress
2857
- watchSlidesProgress: false,
2858
- watchSlidesVisibility: false,
2859
- // Cursor
2860
- grabCursor: false,
2861
- // Clicks
2862
- preventClicks: true,
2863
- preventClicksPropagation: true,
2864
- slideToClickedSlide: false,
2865
- // Lazy Loading
2866
- lazyLoading: false,
2867
- lazyLoadingInPrevNext: false,
2868
- lazyLoadingOnTransitionStart: false,
2869
- // Images
2870
- preloadImages: true,
2871
- updateOnImagesReady: true,
2872
- // loop
2873
- loop: false,
2874
- loopAdditionalSlides: 0,
2875
- loopedSlides: null,
2876
- // Control
2877
- control: undefined,
2878
- controlInverse: false,
2879
- // Swiping/no swiping
2880
- allowSwipeToPrev: true,
2881
- allowSwipeToNext: true,
2882
- swipeHandler: null, //'.swipe-handler',
2883
- noSwiping: true,
2884
- noSwipingClass: 'swiper-no-swiping',
2885
- // NS
2886
- slideClass: 'swiper-slide',
2887
- slideActiveClass: 'swiper-slide-active',
2888
- slideVisibleClass: 'swiper-slide-visible',
2889
- slideDuplicateClass: 'swiper-slide-duplicate',
2890
- slideNextClass: 'swiper-slide-next',
2891
- slidePrevClass: 'swiper-slide-prev',
2892
- wrapperClass: 'swiper-wrapper',
2893
- bulletClass: 'swiper-pagination-bullet',
2894
- bulletActiveClass: 'swiper-pagination-bullet-active',
2895
- buttonDisabledClass: 'swiper-button-disabled',
2896
- paginationHiddenClass: 'swiper-pagination-hidden',
2897
- // Observer
2898
- observer: false,
2899
- observeParents: false,
2900
- // Accessibility
2901
- a11y: false,
2902
- prevSlideMessage: 'Previous slide',
2903
- nextSlideMessage: 'Next slide',
2904
- firstSlideMessage: 'This is the first slide',
2905
- lastSlideMessage: 'This is the last slide',
2906
- // Callbacks
2907
- runCallbacksOnInit: true
2908
- /*
2909
- Callbacks:
2910
- onInit: function (swiper)
2911
- onDestroy: function (swiper)
2912
- onClick: function (swiper, e)
2913
- onTap: function (swiper, e)
2914
- onDoubleTap: function (swiper, e)
2915
- onSliderMove: function (swiper, e)
2916
- onSlideChangeStart: function (swiper)
2917
- onSlideChangeEnd: function (swiper)
2918
- onTransitionStart: function (swiper)
2919
- onTransitionEnd: function (swiper)
2920
- onImagesReady: function (swiper)
2921
- onProgress: function (swiper, progress)
2922
- onTouchStart: function (swiper, e)
2923
- onTouchMove: function (swiper, e)
2924
- onTouchMoveOpposite: function (swiper, e)
2925
- onTouchEnd: function (swiper, e)
2926
- onReachBeginning: function (swiper)
2927
- onReachEnd: function (swiper)
2928
- onSetTransition: function (swiper, duration)
2929
- onSetTranslate: function (swiper, translate)
2930
- onAutoplayStart: function (swiper)
2931
- onAutoplayStop: function (swiper),
2932
- onLazyImageLoad: function (swiper, slide, image)
2933
- onLazyImageReady: function (swiper, slide, image)
2934
- */
2935
-
2936
- },
2937
- isSafari: function () {
2938
- var ua = navigator.userAgent.toLowerCase();
2939
- return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0;
2940
- }(),
2941
- isUiWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent),
2942
- isArray: function isArray(arr) {
2943
- return Object.prototype.toString.apply(arr) === '[object Array]';
2944
- },
2945
- /*==================================================
2946
- Browser
2947
- ====================================================*/
2948
- browser: {
2949
- ie: window.navigator.pointerEnabled || window.navigator.msPointerEnabled,
2950
- ieTouch: window.navigator.msPointerEnabled && window.navigator.msMaxTouchPoints > 1 || window.navigator.pointerEnabled && window.navigator.maxTouchPoints > 1
2951
- },
2952
- /*==================================================
2953
- Devices
2954
- ====================================================*/
2955
- device: function () {
2956
- var ua = navigator.userAgent;
2957
- var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/);
2958
- var ipad = ua.match(/(iPad).*OS\s([\d_]+)/);
2959
- var iphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/);
2960
- return {
2961
- ios: ipad || iphone || ipad,
2962
- android: android
2963
- };
2964
- }(),
2965
- /*==================================================
2966
- Feature Detection
2967
- ====================================================*/
2968
- support: {
2969
- touch: window.Modernizr && Modernizr.touch === true || function () {
2970
- return !!('ontouchstart' in window || window.DocumentTouch && document instanceof DocumentTouch);
2971
- }(),
2972
-
2973
- transforms3d: window.Modernizr && Modernizr.csstransforms3d === true || function () {
2974
- var div = document.createElement('div').style;
2975
- return 'webkitPerspective' in div || 'MozPerspective' in div || 'OPerspective' in div || 'MsPerspective' in div || 'perspective' in div;
2976
- }(),
2977
-
2978
- flexbox: function () {
2979
- var div = document.createElement('div').style;
2980
- var styles = 'alignItems webkitAlignItems webkitBoxAlign msFlexAlign mozBoxAlign webkitFlexDirection msFlexDirection mozBoxDirection mozBoxOrient webkitBoxDirection webkitBoxOrient'.split(' ');
2981
- for (var i = 0; i < styles.length; i++) {
2982
- if (styles[i] in div) return true;
2983
- }
2984
- }(),
2985
-
2986
- observer: function () {
2987
- return 'MutationObserver' in window || 'WebkitMutationObserver' in window;
2988
- }()
2989
- },
2990
- /*==================================================
2991
- Plugins
2992
- ====================================================*/
2993
- plugins: {}
2994
- };
2995
-
2996
- var swiper = function swiper(container, params) {
2997
- return new Swiper(container, params);
2998
- };
2999
-
3000
- exports.swiper = swiper;
3001
-
3002
- /***/ })
3003
-
3004
- /******/ });
3005
- });
1
+ !function(e,a){"object"==typeof exports&&"object"==typeof module?module.exports=a():"function"==typeof define&&define.amd?define([],a):"object"==typeof exports?exports.fastman=a():e.fastman=a()}(this,function(){return function(e){function a(r){if(t[r])return t[r].exports;var s=t[r]={i:r,l:!1,exports:{}};return e[r].call(s.exports,s,s.exports,a),s.l=!0,s.exports}var t={};return a.m=e,a.c=t,a.i=function(e){return e},a.d=function(e,t,r){a.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},a.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return a.d(t,"a",t),t},a.o=function(e,a){return Object.prototype.hasOwnProperty.call(e,a)},a.p="",a(a.s=21)}({0:function(e,a){var t;t=function(){return this}();try{t=t||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(t=window)}e.exports=t},16:function(e,a,t){(function(a){function t(e,t,r){var s={container:a.document.body,offset:0,debounce:15,failsafe:150};void 0!==t&&"function"!=typeof t||(r=t,t={});var n=s.container=t.container||s.container,o=s.offset=t.offset||s.offset,p=s.debounce=t.debounce||s.debounce,d=s.failsafe=t.failsafe||s.failsafe;!0===d?d=150:!1===d&&(d=0),d>0&&d<p&&(d=p+50);for(var c=0;c<l.length;c++)if(l[c].container===n&&l[c]._debounce===p&&l[c]._failsafe===d)return l[c].isInViewport(e,o,r);return l[l.push(i(n,p,d))-1].isInViewport(e,o,r)}function r(e,a,t){e.attachEvent?e.attachEvent("on"+a,t):e.addEventListener(a,t,!1)}function s(e,a,t){var r;return function(){function s(){r=null,t||e.apply(i,n)}var i=this,n=arguments,o=t&&!r;clearTimeout(r),r=setTimeout(s,a),o&&e.apply(i,n)}}function i(e,t,i){function l(e,a,t){if(!t)return m(e,a);var r=c(e,a,t);return r.watch(),r}function c(e,a,t){function r(){f.add(e,a,t)}function s(){f.remove(e)}return{watch:r,dispose:s}}function u(e,a,t){m(e,a)&&(f.remove(e),t(e))}function m(t,r){if(!t)return!1;if(!d(a.document.documentElement,t)||!d(a.document.documentElement,e))return!1;if(!t.offsetWidth||!t.offsetHeight)return!1;var s=t.getBoundingClientRect(),i={};if(e===a.document.body)i={top:-r,left:-r,right:a.document.documentElement.clientWidth+r,bottom:a.document.documentElement.clientHeight+r};else{var n=e.getBoundingClientRect();i={top:n.top-r,left:n.left-r,right:n.right+r,bottom:n.bottom+r}}return s.right>=i.left&&s.left<=i.right&&s.bottom>=i.top&&s.top<=i.bottom}var f=n(),v=e===a.document.body?a:e,h=s(f.checkAll(u),t);return r(v,"scroll",h),v===a&&r(a,"resize",h),p&&o(f,e,h),i>0&&setInterval(h,i),{container:e,isInViewport:l,_debounce:t,_failsafe:i}}function n(){function e(e,a,t){r(e)||i.push([e,a,t])}function a(e){var a=t(e);-1!==a&&i.splice(a,1)}function t(e){for(var a=i.length-1;a>=0;a--)if(i[a][0]===e)return a;return-1}function r(e){return-1!==t(e)}function s(e){return function(){for(var a=i.length-1;a>=0;a--)e.apply(this,i[a])}}var i=[];return{add:e,remove:a,isWatched:r,checkAll:s}}function o(e,a,t){function r(e){!0===e.some(s)&&setTimeout(t,0)}function s(a){var t=o.call([],Array.prototype.slice.call(a.addedNodes),a.target);return n.call(t,e.isWatched).length>0}var i=new MutationObserver(r),n=Array.prototype.filter,o=Array.prototype.concat;i.observe(a,{childList:!0,subtree:!0,attributes:!0})}e.exports=t;var l=[],p="function"==typeof a.MutationObserver,d=function(){return!a.document||(a.document.documentElement.compareDocumentPosition?function(e,a){return!!(16&e.compareDocumentPosition(a))}:a.document.documentElement.contains?function(e,a){return e!==a&&!!e.contains&&e.contains(a)}:function(e,a){for(;a=a.parentNode;)if(a===e)return!0;return!1})}}).call(a,t(0))},21:function(e,a,t){"use strict";Object.defineProperty(a,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=t(16),i=function e(a,t){function i(){return"horizontal"===h.params.direction}function n(){h.autoplayTimeoutId=setTimeout(function(){h.params.loop?(h.fixLoop(),h._slideNext()):h.isEnd?t.autoplayStopOnLast?h.stopAutoplay():h._slideTo(0):h._slideNext()},h.params.autoplay)}function o(e,a){var t=$(e.target);if(!t.is(a))if("string"==typeof a)t=t.parents(a);else if(a.nodeType){var r;return t.parents().each(function(e,t){t===a&&(r=a)}),r?a:void 0}if(0!==t.length)return t[0]}function l(e,a){a=a||{};var t=window.MutationObserver||window.WebkitMutationObserver,r=new t(function(e){e.forEach(function(e){h.onResize(),h.emit("onObserverUpdate",h,e)})});r.observe(e,{attributes:void 0===a.attributes||a.attributes,childList:void 0===a.childList||a.childList,characterData:void 0===a.characterData||a.characterData}),h.observers.push(r)}function p(e,a){e=$(e);var t,r,s;t=e.attr("data-swiper-parallax")||"0",r=e.attr("data-swiper-parallax-x"),s=e.attr("data-swiper-parallax-y"),r||s?(r=r||"0",s=s||"0"):i()?(r=t,s="0"):(s=t,r="0"),r=r.indexOf("%")>=0?parseInt(r,10)*a+"%":r*a+"px",s=s.indexOf("%")>=0?parseInt(s,10)*a+"%":s*a+"px",e.transform("translate3d("+r+", "+s+",0px)")}function d(e){return 0!==e.indexOf("on")&&(e=e[0]!==e[0].toUpperCase()?"on"+e[0].toUpperCase()+e.substring(1):"on"+e),e}function c(e){h.init()}var u=this.defaults,m=t&&t.virtualTranslate;t=t||{};for(var f in u)if(void 0===t[f])t[f]=u[f];else if("object"===r(t[f]))for(var v in u[f])void 0===t[f][v]&&(t[f][v]=u[f][v]);var h=this;if(h.params=t,h.classNames=[],h.$=$,h.container=$(a),0!==h.container.length){if(h.container.length>1)return void h.container.each(function(){new $.Swiper(this,t)});h.container[0].swiper=h,h.container.zeptoData("swiper",h),h.classNames.push("swiper-container-"+h.params.direction),h.params.freeMode&&h.classNames.push("swiper-container-free-mode"),h.support.flexbox||(h.classNames.push("swiper-container-no-flexbox"),h.params.slidesPerColumn=1),(h.params.parallax||h.params.watchSlidesVisibility)&&(h.params.watchSlidesProgress=!0),["cube","coverflow"].indexOf(h.params.effect)>=0&&(h.support.transforms3d?(h.params.watchSlidesProgress=!0,h.classNames.push("swiper-container-3d")):h.params.effect="slide"),"slide"!==h.params.effect&&h.classNames.push("swiper-container-"+h.params.effect),"cube"===h.params.effect&&(h.params.resistanceRatio=0,h.params.slidesPerView=1,h.params.slidesPerColumn=1,h.params.slidesPerGroup=1,h.params.centeredSlides=!1,h.params.spaceBetween=0,h.params.virtualTranslate=!0,h.params.setWrapperSize=!1),"fade"===h.params.effect&&(h.params.slidesPerView=1,h.params.slidesPerColumn=1,h.params.slidesPerGroup=1,h.params.watchSlidesProgress=!0,h.params.spaceBetween=0,void 0===m&&(h.params.virtualTranslate=!0)),h.params.grabCursor&&h.support.touch&&(h.params.grabCursor=!1),h.wrapper=h.container.children("."+h.params.wrapperClass),h.params.pagination&&(h.paginationContainer=$(h.params.pagination),h.params.paginationClickable&&h.paginationContainer.addClass("swiper-pagination-clickable")),h.rtl=i()&&("rtl"===h.container[0].dir.toLowerCase()||"rtl"===h.container.css("direction")),h.rtl&&h.classNames.push("swiper-container-rtl"),h.rtl&&(h.wrongRTL="-webkit-box"===h.wrapper.css("display")),h.params.slidesPerColumn>1&&h.classNames.push("swiper-container-multirow"),h.device.android&&h.classNames.push("swiper-container-android"),h.container.addClass(h.classNames.join(" ")),h.translate=0,h.progress=0,h.velocity=0,h.lockSwipeToNext=function(){h.params.allowSwipeToNext=!1},h.lockSwipeToPrev=function(){h.params.allowSwipeToPrev=!1},h.lockSwipes=function(){h.params.allowSwipeToNext=h.params.allowSwipeToPrev=!1},h.unlockSwipeToNext=function(){h.params.allowSwipeToNext=!0},h.unlockSwipeToPrev=function(){h.params.allowSwipeToPrev=!0},h.unlockSwipes=function(){h.params.allowSwipeToNext=h.params.allowSwipeToPrev=!0},h.params.grabCursor&&(h.container[0].style.cursor="move",h.container[0].style.cursor="-webkit-grab",h.container[0].style.cursor="-moz-grab",h.container[0].style.cursor="grab"),h.imagesToLoad=[],h.imagesLoaded=0,h.loadImage=function(e,a,t,r){function s(){r&&r()}var i;e.complete&&t?s():a?(i=new Image,i.onload=s,i.onerror=s,i.src=a):s()},h.preloadImages=function(){function e(){void 0!==h&&null!==h&&(void 0!==h.imagesLoaded&&h.imagesLoaded++,h.imagesLoaded===h.imagesToLoad.length&&(h.params.updateOnImagesReady&&h.update(),h.emit("onImagesReady",h)))}h.imagesToLoad=h.container.find("img");for(var a=0;a<h.imagesToLoad.length;a++)h.loadImage(h.imagesToLoad[a],h.imagesToLoad[a].currentSrc||h.imagesToLoad[a].getAttribute("src"),!0,e)},h.autoplayTimeoutId=void 0,h.autoplaying=!1,h.autoplayPaused=!1,h.startAutoplay=function(){return void 0===h.autoplayTimeoutId&&(!!h.params.autoplay&&(!h.autoplaying&&(h.autoplaying=!0,h.emit("onAutoplayStart",h),void n())))},h.stopAutoplay=function(){h.autoplayTimeoutId&&(h.autoplayTimeoutId&&clearTimeout(h.autoplayTimeoutId),h.autoplaying=!1,h.autoplayTimeoutId=void 0,h.emit("onAutoplayStop",h))},h.pauseAutoplay=function(e){h.autoplayPaused||(h.autoplayTimeoutId&&clearTimeout(h.autoplayTimeoutId),h.autoplayPaused=!0,0===e?(h.autoplayPaused=!1,n()):h.wrapper.transitionEnd(function(){h.autoplayPaused=!1,h.autoplaying?n():h.stopAutoplay()}))},h.minTranslate=function(){return-h.snapGrid[0]},h.maxTranslate=function(){return-h.snapGrid[h.snapGrid.length-1]},h.updateContainerSize=function(){h.width=h.container[0].clientWidth,h.height=h.container[0].clientHeight,h.size=i()?h.width:h.height},h.updateSlidesSize=function(){h.slides=h.wrapper.children("."+h.params.slideClass),h.snapGrid=[],h.slidesGrid=[],h.slidesSizesGrid=[];var e,a=h.params.spaceBetween,t=0,r=0,s=0;"string"==typeof a&&a.indexOf("%")>=0&&(a=parseFloat(a.replace("%",""))/100*h.size),h.virtualSize=-a,h.rtl?h.slides.css({marginLeft:"",marginTop:""}):h.slides.css({marginRight:"",marginBottom:""});var n;h.params.slidesPerColumn>1&&(n=Math.floor(h.slides.length/h.params.slidesPerColumn)===h.slides.length/h.params.slidesPerColumn?h.slides.length:Math.ceil(h.slides.length/h.params.slidesPerColumn)*h.params.slidesPerColumn);var o;for(e=0;e<h.slides.length;e++){o=0;var l=h.slides.eq(e);if(h.params.slidesPerColumn>1){var p,d,c,u,m=h.params.slidesPerColumn;"column"===h.params.slidesPerColumnFill?(d=Math.floor(e/m),c=e-d*m,p=d+c*n/m,l.css({"-webkit-box-ordinal-group":p,"-moz-box-ordinal-group":p,"-ms-flex-order":p,"-webkit-order":p,order:p})):(u=n/m,c=Math.floor(e/u),d=e-c*u),l.css({"margin-top":0!==c&&h.params.spaceBetween&&h.params.spaceBetween+"px"}).attr("data-swiper-column",d).attr("data-swiper-row",c)}"none"!==l.css("display")&&("auto"===h.params.slidesPerView?o=i()?l.outerWidth(!0):l.outerHeight(!0):(o=(h.size-(h.params.slidesPerView-1)*a)/h.params.slidesPerView,i()?h.slides[e].style.width=o+"px":h.slides[e].style.height=o+"px"),h.slides[e].swiperSlideSize=o,h.slidesSizesGrid.push(o),h.params.centeredSlides?(t=t+o/2+r/2+a,0===e&&(t=t-h.size/2-a),Math.abs(t)<.001&&(t=0),s%h.params.slidesPerGroup==0&&h.snapGrid.push(t),h.slidesGrid.push(t)):(s%h.params.slidesPerGroup==0&&h.snapGrid.push(t),h.slidesGrid.push(t),t=t+o+a),h.virtualSize+=o+a,r=o,s++)}h.virtualSize=Math.max(h.virtualSize,h.size);var f;if(h.rtl&&h.wrongRTL&&("slide"===h.params.effect||"coverflow"===h.params.effect)&&h.wrapper.css({width:h.virtualSize+h.params.spaceBetween+"px"}),h.support.flexbox&&!h.params.setWrapperSize||(i()?h.wrapper.css({width:h.virtualSize+h.params.spaceBetween+"px"}):h.wrapper.css({height:h.virtualSize+h.params.spaceBetween+"px"})),h.params.slidesPerColumn>1&&(h.virtualSize=(o+h.params.spaceBetween)*n,h.virtualSize=Math.ceil(h.virtualSize/h.params.slidesPerColumn)-h.params.spaceBetween,h.wrapper.css({width:h.virtualSize+h.params.spaceBetween+"px"}),h.params.centeredSlides)){for(f=[],e=0;e<h.snapGrid.length;e++)h.snapGrid[e]<h.virtualSize+h.snapGrid[0]&&f.push(h.snapGrid[e]);h.snapGrid=f}if(!h.params.centeredSlides){for(f=[],e=0;e<h.snapGrid.length;e++)h.snapGrid[e]<=h.virtualSize-h.size&&f.push(h.snapGrid[e]);h.snapGrid=f,Math.floor(h.virtualSize-h.size)>Math.floor(h.snapGrid[h.snapGrid.length-1])&&h.snapGrid.push(h.virtualSize-h.size)}0===h.snapGrid.length&&(h.snapGrid=[0]),0!==h.params.spaceBetween&&(i()?h.rtl?h.slides.css({marginLeft:a+"px"}):h.slides.css({marginRight:a+"px"}):h.slides.css({marginBottom:a+"px"})),h.params.watchSlidesProgress&&h.updateSlidesOffset()},h.updateSlidesOffset=function(){for(var e=0;e<h.slides.length;e++)h.slides[e].swiperSlideOffset=i()?h.slides[e].offsetLeft:h.slides[e].offsetTop},h.updateSlidesProgress=function(e){if(void 0===e&&(e=h.translate||0),0!==h.slides.length){void 0===h.slides[0].swiperSlideOffset&&h.updateSlidesOffset();var a=h.params.centeredSlides?-e+h.size/2:-e;h.rtl&&(a=h.params.centeredSlides?e-h.size/2:e),h.slides.removeClass(h.params.slideVisibleClass);for(var t=0;t<h.slides.length;t++){var r=h.slides[t],s=!0===h.params.centeredSlides?r.swiperSlideSize/2:0,i=(a-r.swiperSlideOffset-s)/(r.swiperSlideSize+h.params.spaceBetween);if(h.params.watchSlidesVisibility){var n=-(a-r.swiperSlideOffset-s),o=n+h.slidesSizesGrid[t];(n>=0&&n<h.size||o>0&&o<=h.size||n<=0&&o>=h.size)&&h.slides.eq(t).addClass(h.params.slideVisibleClass)}r.progress=h.rtl?-i:i}}},h.updateProgress=function(e){void 0===e&&(e=h.translate||0);var a=h.maxTranslate()-h.minTranslate();0===a?(h.progress=0,h.isBeginning=h.isEnd=!0):(h.progress=(e-h.minTranslate())/a,h.isBeginning=h.progress<=0,h.isEnd=h.progress>=1),h.isBeginning&&h.emit("onReachBeginning",h),h.isEnd&&h.emit("onReachEnd",h),h.params.watchSlidesProgress&&h.updateSlidesProgress(e),h.emit("onProgress",h,h.progress)},h.updateActiveIndex=function(){var e,a,t,r=h.rtl?h.translate:-h.translate;for(a=0;a<h.slidesGrid.length;a++)void 0!==h.slidesGrid[a+1]?r>=h.slidesGrid[a]&&r<h.slidesGrid[a+1]-(h.slidesGrid[a+1]-h.slidesGrid[a])/2?e=a:r>=h.slidesGrid[a]&&r<h.slidesGrid[a+1]&&(e=a+1):r>=h.slidesGrid[a]&&(e=a);(e<0||void 0===e)&&(e=0),t=Math.floor(e/h.params.slidesPerGroup),t>=h.snapGrid.length&&(t=h.snapGrid.length-1),e!==h.activeIndex&&(h.snapIndex=t,h.previousIndex=h.activeIndex,h.activeIndex=e,h.updateClasses())},h.updateClasses=function(){h.slides.removeClass(h.params.slideActiveClass+" "+h.params.slideNextClass+" "+h.params.slidePrevClass);var e=h.slides.eq(h.activeIndex);if(e.addClass(h.params.slideActiveClass),e.next("."+h.params.slideClass).addClass(h.params.slideNextClass),e.prev("."+h.params.slideClass).addClass(h.params.slidePrevClass),h.bullets&&h.bullets.length>0){h.bullets.removeClass(h.params.bulletActiveClass);var a;h.params.loop?(a=Math.ceil(h.activeIndex-h.loopedSlides)/h.params.slidesPerGroup,a>h.slides.length-1-2*h.loopedSlides&&(a-=h.slides.length-2*h.loopedSlides),a>h.bullets.length-1&&(a-=h.bullets.length)):a=void 0!==h.snapIndex?h.snapIndex:h.activeIndex||0,h.paginationContainer.length>1?h.bullets.each(function(){$(this).index()===a&&$(this).addClass(h.params.bulletActiveClass)}):h.bullets.eq(a).addClass(h.params.bulletActiveClass)}h.params.loop||(h.params.prevButton&&(h.isBeginning?($(h.params.prevButton).addClass(h.params.buttonDisabledClass),h.params.a11y&&h.a11y&&h.a11y.disable($(h.params.prevButton))):($(h.params.prevButton).removeClass(h.params.buttonDisabledClass),h.params.a11y&&h.a11y&&h.a11y.enable($(h.params.prevButton)))),h.params.nextButton&&(h.isEnd?($(h.params.nextButton).addClass(h.params.buttonDisabledClass),h.params.a11y&&h.a11y&&h.a11y.disable($(h.params.nextButton))):($(h.params.nextButton).removeClass(h.params.buttonDisabledClass),h.params.a11y&&h.a11y&&h.a11y.enable($(h.params.nextButton)))))},h.updatePagination=function(){if(h.params.pagination&&h.paginationContainer&&h.paginationContainer.length>0){for(var e="",a=h.params.loop?Math.ceil((h.slides.length-2*h.loopedSlides)/h.params.slidesPerGroup):h.snapGrid.length,t=0;t<a;t++)h.params.paginationBulletRender?e+=h.params.paginationBulletRender(t,h.params.bulletClass):e+='<span class="'+h.params.bulletClass+'"></span>';h.paginationContainer.html(e),h.bullets=h.paginationContainer.find("."+h.params.bulletClass)}},h.update=function(e){function a(){t=Math.min(Math.max(h.translate,h.maxTranslate()),h.minTranslate()),h.setWrapperTranslate(t),h.updateActiveIndex(),h.updateClasses()}if(h.updateContainerSize(),h.updateSlidesSize(),h.updateProgress(),h.updatePagination(),h.updateClasses(),h.params.scrollbar&&h.scrollbar&&h.scrollbar.set(),e){var t;h.params.freeMode?a():("auto"===h.params.slidesPerView&&h.isEnd&&!h.params.centeredSlides?h.slideTo(h.slides.length-1,0,!1,!0):h.slideTo(h.activeIndex,0,!1,!0))||a()}},h.onResize=function(){if(h.updateContainerSize(),h.updateSlidesSize(),h.updateProgress(),("auto"===h.params.slidesPerView||h.params.freeMode)&&h.updatePagination(),h.params.scrollbar&&h.scrollbar&&h.scrollbar.set(),h.params.freeMode){var e=Math.min(Math.max(h.translate,h.maxTranslate()),h.minTranslate());h.setWrapperTranslate(e),h.updateActiveIndex(),h.updateClasses()}else h.updateClasses(),"auto"===h.params.slidesPerView&&h.isEnd&&!h.params.centeredSlides?h.slideTo(h.slides.length-1,0,!1,!0):h.slideTo(h.activeIndex,0,!1,!0)};var g=["mousedown","mousemove","mouseup"];window.navigator.pointerEnabled?g=["pointerdown","pointermove","pointerup"]:window.navigator.msPointerEnabled&&(g=["MSPointerDown","MSPointerMove","MSPointerUp"]),h.touchEvents={start:h.support.touch||!h.params.simulateTouch?"touchstart":g[0],move:h.support.touch||!h.params.simulateTouch?"touchmove":g[1],end:h.support.touch||!h.params.simulateTouch?"touchend":g[2]},(window.navigator.pointerEnabled||window.navigator.msPointerEnabled)&&("container"===h.params.touchEventsTarget?h.container:h.wrapper).addClass("swiper-wp8-"+h.params.direction),h.initEvents=function(e){var a=e?"off":"on",r=e?"removeEventListener":"addEventListener",s="container"===h.params.touchEventsTarget?h.container[0]:h.wrapper[0],i=h.support.touch?s:document,n=!!h.params.nested;h.browser.ie?(s[r](h.touchEvents.start,h.onTouchStart,!1),i[r](h.touchEvents.move,h.onTouchMove,n),i[r](h.touchEvents.end,h.onTouchEnd,!1)):(h.support.touch&&(s[r](h.touchEvents.start,h.onTouchStart,!1),s[r](h.touchEvents.move,h.onTouchMove,n),s[r](h.touchEvents.end,h.onTouchEnd,!1)),!t.simulateTouch||h.device.ios||h.device.android||(s[r]("mousedown",h.onTouchStart,!1),i[r]("mousemove",h.onTouchMove,n),i[r]("mouseup",h.onTouchEnd,!1))),window[r]("resize",h.onResize),h.params.nextButton&&($(h.params.nextButton)[a]("click",h.onClickNext),h.params.a11y&&h.a11y&&$(h.params.nextButton)[a]("keydown",h.a11y.onEnterKey)),h.params.prevButton&&($(h.params.prevButton)[a]("click",h.onClickPrev),h.params.a11y&&h.a11y&&$(h.params.prevButton)[a]("keydown",h.a11y.onEnterKey)),h.params.pagination&&h.params.paginationClickable&&$(h.paginationContainer)[a]("click","."+h.params.bulletClass,h.onClickIndex),(h.params.preventClicks||h.params.preventClicksPropagation)&&s[r]("click",h.preventClicks,!0)},h.attachEvents=function(){h.initEvents()},h.detachEvents=function(){h.initEvents(!0)},h.allowClick=!0,h.preventClicks=function(e){h.allowClick||(h.params.preventClicks&&e.preventDefault(),h.params.preventClicksPropagation&&(e.stopPropagation(),e.stopImmediatePropagation()))},h.onClickNext=function(e){e.preventDefault(),h.slideNext()},h.onClickPrev=function(e){e.preventDefault(),h.slidePrev()},h.onClickIndex=function(e){e.preventDefault();var a=$(this).index()*h.params.slidesPerGroup;h.params.loop&&(a+=h.loopedSlides),h.slideTo(a)},h.updateClickedSlide=function(e){var a=o(e,"."+h.params.slideClass);if(!a)return h.clickedSlide=void 0,void(h.clickedIndex=void 0);if(h.clickedSlide=a,h.clickedIndex=$(a).index(),h.params.slideToClickedSlide&&void 0!==h.clickedIndex&&h.clickedIndex!==h.activeIndex){var t,r=h.clickedIndex;if(h.params.loop)if(t=$(h.clickedSlide).attr("data-swiper-slide-index"),r>h.slides.length-h.params.slidesPerView)h.fixLoop(),r=h.wrapper.children("."+h.params.slideClass+'[data-swiper-slide-index="'+t+'"]').eq(0).index(),setTimeout(function(){h.slideTo(r)},0);else if(r<h.params.slidesPerView-1){h.fixLoop();var s=h.wrapper.children("."+h.params.slideClass+'[data-swiper-slide-index="'+t+'"]');r=s.eq(s.length-1).index(),setTimeout(function(){h.slideTo(r)},0)}else h.slideTo(r);else h.slideTo(r)}};var w,b,x,y,T,S,C,P,z,M="input, select, textarea, button",I=Date.now(),k=[];h.animating=!1,h.touches={startX:0,startY:0,currentX:0,currentY:0,diff:0};var E,G;h.onTouchStart=function(e){if(e.originalEvent&&(e=e.originalEvent),(E="touchstart"===e.type)||!("which"in e)||3!==e.which){if(h.params.noSwiping&&o(e,"."+h.params.noSwipingClass))return void(h.allowClick=!0);if(!h.params.swipeHandler||o(e,h.params.swipeHandler)){if(w=!0,b=!1,y=void 0,G=void 0,h.touches.startX=h.touches.currentX="touchstart"===e.type?e.targetTouches[0].pageX:e.pageX,h.touches.startY=h.touches.currentY="touchstart"===e.type?e.targetTouches[0].pageY:e.pageY,x=Date.now(),h.allowClick=!0,h.updateContainerSize(),h.swipeDirection=void 0,h.params.threshold>0&&(C=!1),"touchstart"!==e.type){var a=!0;$(e.target).is(M)&&(a=!1),document.activeElement&&$(document.activeElement).is(M)&&document.activeElement.blur(),a&&e.preventDefault()}h.emit("onTouchStart",h,e)}}},h.onTouchMove=function(e){if(e.originalEvent&&(e=e.originalEvent),!(E&&"mousemove"===e.type||e.preventedByNestedSwiper)){if(h.params.onlyExternal)return b=!0,void(h.allowClick=!1);if(E&&document.activeElement&&e.target===document.activeElement&&$(e.target).is(M))return b=!0,void(h.allowClick=!1);if(h.emit("onTouchMove",h,e),!(e.targetTouches&&e.targetTouches.length>1)){if(h.touches.currentX="touchmove"===e.type?e.targetTouches[0].pageX:e.pageX,h.touches.currentY="touchmove"===e.type?e.targetTouches[0].pageY:e.pageY,void 0===y){var a=180*Math.atan2(Math.abs(h.touches.currentY-h.touches.startY),Math.abs(h.touches.currentX-h.touches.startX))/Math.PI;y=i()?a>h.params.touchAngle:90-a>h.params.touchAngle}if(y&&h.emit("onTouchMoveOpposite",h,e),void 0===G&&h.browser.ieTouch&&(h.touches.currentX===h.touches.startX&&h.touches.currentY===h.touches.startY||(G=!0)),w){if(y)return void(w=!1);if(G||!h.browser.ieTouch){h.allowClick=!1,h.emit("onSliderMove",h,e),e.preventDefault(),h.params.touchMoveStopPropagation&&!h.params.nested&&e.stopPropagation(),b||(t.loop&&h.fixLoop(),S=h.getWrapperTranslate(),h.setWrapperTransition(0),h.animating&&h.wrapper.trigger("webkitTransitionEnd transitionend oTransitionEnd MSTransitionEnd msTransitionEnd"),h.params.autoplay&&h.autoplaying&&(h.params.autoplayDisableOnInteraction?h.stopAutoplay():h.pauseAutoplay()),z=!1,h.params.grabCursor&&(h.container[0].style.cursor="move",h.container[0].style.cursor="-webkit-grabbing",h.container[0].style.cursor="-moz-grabbin",h.container[0].style.cursor="grabbing")),b=!0;var r=h.touches.diff=i()?h.touches.currentX-h.touches.startX:h.touches.currentY-h.touches.startY;r*=h.params.touchRatio,h.rtl&&(r=-r),h.swipeDirection=r>0?"prev":"next",T=r+S;var s=!0;if(r>0&&T>h.minTranslate()?(s=!1,h.params.resistance&&(T=h.minTranslate()-1+Math.pow(-h.minTranslate()+S+r,h.params.resistanceRatio))):r<0&&T<h.maxTranslate()&&(s=!1,h.params.resistance&&(T=h.maxTranslate()+1-Math.pow(h.maxTranslate()-S-r,h.params.resistanceRatio))),s&&(e.preventedByNestedSwiper=!0),!h.params.allowSwipeToNext&&"next"===h.swipeDirection&&T<S&&(T=S),!h.params.allowSwipeToPrev&&"prev"===h.swipeDirection&&T>S&&(T=S),h.params.followFinger){if(h.params.threshold>0){if(!(Math.abs(r)>h.params.threshold||C))return void(T=S);if(!C)return C=!0,h.touches.startX=h.touches.currentX,h.touches.startY=h.touches.currentY,T=S,void(h.touches.diff=i()?h.touches.currentX-h.touches.startX:h.touches.currentY-h.touches.startY)}(h.params.freeMode||h.params.watchSlidesProgress)&&h.updateActiveIndex(),h.params.freeMode&&(0===k.length&&k.push({position:h.touches[i()?"startX":"startY"],time:x}),k.push({position:h.touches[i()?"currentX":"currentY"],time:(new Date).getTime()})),h.updateProgress(T),h.setWrapperTranslate(T)}}}}}},h.onTouchEnd=function(e){if(e.originalEvent&&(e=e.originalEvent),h.emit("onTouchEnd",h,e),w){h.params.grabCursor&&b&&w&&(h.container[0].style.cursor="move",h.container[0].style.cursor="-webkit-grab",h.container[0].style.cursor="-moz-grab",h.container[0].style.cursor="grab");var a=Date.now(),t=a-x;if(h.allowClick&&(h.updateClickedSlide(e),h.emit("onTap",h,e),t<300&&a-I>300&&(P&&clearTimeout(P),P=setTimeout(function(){h&&(h.params.paginationHide&&h.paginationContainer.length>0&&!$(e.target).hasClass(h.params.bulletClass)&&h.paginationContainer.toggleClass(h.params.paginationHiddenClass),h.emit("onClick",h,e))},300)),t<300&&a-I<300&&(P&&clearTimeout(P),h.emit("onDoubleTap",h,e))),I=Date.now(),setTimeout(function(){h&&h.allowClick&&(h.allowClick=!0)},0),!w||!b||!h.swipeDirection||0===h.touches.diff||T===S)return void(w=b=!1);w=b=!1;var r;if(r=h.params.followFinger?h.rtl?h.translate:-h.translate:-T,h.params.freeMode){if(r<-h.minTranslate())return void h.slideTo(h.activeIndex);if(r>-h.maxTranslate())return void h.slideTo(h.slides.length-1);if(h.params.freeModeMomentum){if(k.length>1){var s=k.pop(),i=k.pop(),n=s.position-i.position,o=s.time-i.time;h.velocity=n/o,h.velocity=h.velocity/2,Math.abs(h.velocity)<.02&&(h.velocity=0),(o>150||(new Date).getTime()-s.time>300)&&(h.velocity=0)}else h.velocity=0;k.length=0;var l=1e3*h.params.freeModeMomentumRatio,p=h.velocity*l,d=h.translate+p;h.rtl&&(d=-d);var c,u=!1,m=20*Math.abs(h.velocity)*h.params.freeModeMomentumBounceRatio;d<h.maxTranslate()&&(h.params.freeModeMomentumBounce?(d+h.maxTranslate()<-m&&(d=h.maxTranslate()-m),c=h.maxTranslate(),u=!0,z=!0):d=h.maxTranslate()),d>h.minTranslate()&&(h.params.freeModeMomentumBounce?(d-h.minTranslate()>m&&(d=h.minTranslate()+m),c=h.minTranslate(),u=!0,z=!0):d=h.minTranslate()),0!==h.velocity&&(l=h.rtl?Math.abs((-d-h.translate)/h.velocity):Math.abs((d-h.translate)/h.velocity)),h.params.freeModeMomentumBounce&&u?(h.updateProgress(c),h.setWrapperTransition(l),h.setWrapperTranslate(d),h.onTransitionStart(),h.animating=!0,h.wrapper.transitionEnd(function(){z&&(h.emit("onMomentumBounce",h),h.setWrapperTransition(h.params.speed),h.setWrapperTranslate(c),h.wrapper.transitionEnd(function(){h.onTransitionEnd()}))})):h.velocity?(h.updateProgress(d),h.setWrapperTransition(l),h.setWrapperTranslate(d),h.onTransitionStart(),h.animating||(h.animating=!0,h.wrapper.transitionEnd(function(){h.onTransitionEnd()}))):h.updateProgress(d),h.updateActiveIndex()}return void((!h.params.freeModeMomentum||t>=h.params.longSwipesMs)&&(h.updateProgress(),h.updateActiveIndex()))}var f,v=0,g=h.slidesSizesGrid[0];for(f=0;f<h.slidesGrid.length;f+=h.params.slidesPerGroup)void 0!==h.slidesGrid[f+h.params.slidesPerGroup]?r>=h.slidesGrid[f]&&r<h.slidesGrid[f+h.params.slidesPerGroup]&&(v=f,g=h.slidesGrid[f+h.params.slidesPerGroup]-h.slidesGrid[f]):r>=h.slidesGrid[f]&&(v=f,g=h.slidesGrid[h.slidesGrid.length-1]-h.slidesGrid[h.slidesGrid.length-2]);var y=(r-h.slidesGrid[v])/g;if(t>h.params.longSwipesMs){if(!h.params.longSwipes)return void h.slideTo(h.activeIndex);"next"===h.swipeDirection&&(y>=h.params.longSwipesRatio?h.slideTo(v+h.params.slidesPerGroup):h.slideTo(v)),"prev"===h.swipeDirection&&(y>1-h.params.longSwipesRatio?h.slideTo(v+h.params.slidesPerGroup):h.slideTo(v))}else{if(!h.params.shortSwipes)return void h.slideTo(h.activeIndex);"next"===h.swipeDirection&&h.slideTo(v+h.params.slidesPerGroup),"prev"===h.swipeDirection&&h.slideTo(v)}}},h._slideTo=function(e,a){return h.slideTo(e,a,!0,!0)},h.slideTo=function(e,a,t,r){void 0===t&&(t=!0),void 0===e&&(e=0),e<0&&(e=0),h.snapIndex=Math.floor(e/h.params.slidesPerGroup),h.snapIndex>=h.snapGrid.length&&(h.snapIndex=h.snapGrid.length-1);var s=-h.snapGrid[h.snapIndex];h.params.autoplay&&h.autoplaying&&(r||!h.params.autoplayDisableOnInteraction?h.pauseAutoplay(a):h.stopAutoplay()),h.updateProgress(s);for(var i=0;i<h.slidesGrid.length;i++)-s>=h.slidesGrid[i]&&(e=i);return void 0===a&&(a=h.params.speed),h.previousIndex=h.activeIndex||0,h.activeIndex=e,s===h.translate?(h.updateClasses(),!1):(h.updateClasses(),h.onTransitionStart(t),0===a?(h.setWrapperTransition(0),h.setWrapperTranslate(s),h.onTransitionEnd(t)):(h.setWrapperTransition(a),h.setWrapperTranslate(s),h.animating||(h.animating=!0,h.wrapper.transitionEnd(function(){h.onTransitionEnd(t)}))),!0)},h.onTransitionStart=function(e){void 0===e&&(e=!0),h.lazy&&h.lazy.onTransitionStart(),e&&(h.emit("onTransitionStart",h),h.activeIndex!==h.previousIndex&&h.emit("onSlideChangeStart",h))},h.onTransitionEnd=function(e){h.animating=!1,h.setWrapperTransition(0),void 0===e&&(e=!0),h.lazy&&h.lazy.onTransitionEnd(),e&&(h.emit("onTransitionEnd",h),h.activeIndex!==h.previousIndex&&h.emit("onSlideChangeEnd",h)),h.params.hashnav&&h.hashnav&&h.hashnav.setHash()},h.slideNext=function(e,a,t){return h.params.loop?!h.animating&&(h.fixLoop(),h.slideTo(h.activeIndex+h.params.slidesPerGroup,a,e,t)):h.slideTo(h.activeIndex+h.params.slidesPerGroup,a,e,t)},h._slideNext=function(e){return h.slideNext(!0,e,!0)},h.slidePrev=function(e,a,t){return h.params.loop?!h.animating&&(h.fixLoop(),h.slideTo(h.activeIndex-1,a,e,t)):h.slideTo(h.activeIndex-1,a,e,t)},h._slidePrev=function(e){return h.slidePrev(!0,e,!0)},h.slideReset=function(e,a){return h.slideTo(h.activeIndex,a,e)},h.setWrapperTransition=function(e,a){h.wrapper.transition(e),"slide"!==h.params.effect&&h.effects[h.params.effect]&&h.effects[h.params.effect].setTransition(e),h.params.parallax&&h.parallax&&h.parallax.setTransition(e),h.params.scrollbar&&h.scrollbar&&h.scrollbar.setTransition(e),h.params.control&&h.controller&&h.controller.setTransition(e,a),h.emit("onSetTransition",h,e)},h.setWrapperTranslate=function(e,a,t){var r=0,s=0;i()?r=h.rtl?-e:e:s=e,h.params.virtualTranslate||(h.support.transforms3d?h.wrapper.transform("translate3d("+r+"px, "+s+"px, 0px)"):h.wrapper.transform("translate("+r+"px, "+s+"px)")),h.translate=i()?r:s,a&&h.updateActiveIndex(),"slide"!==h.params.effect&&h.effects[h.params.effect]&&h.effects[h.params.effect].setTranslate(h.translate),h.params.parallax&&h.parallax&&h.parallax.setTranslate(h.translate),h.params.scrollbar&&h.scrollbar&&h.scrollbar.setTranslate(h.translate),h.params.control&&h.controller&&h.controller.setTranslate(h.translate,t),h.emit("onSetTranslate",h,h.translate)},h.getTranslate=function(e,a){var t,r,s,i;return void 0===a&&(a="x"),h.params.virtualTranslate?h.rtl?-h.translate:h.translate:(s=window.getComputedStyle(e,null),window.WebKitCSSMatrix?i=new WebKitCSSMatrix("none"===s.webkitTransform?"":s.webkitTransform):(i=s.MozTransform||s.OTransform||s.MsTransform||s.msTransform||s.transform||s.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),t=i.toString().split(",")),"x"===a&&(r=window.WebKitCSSMatrix?i.m41:16===t.length?parseFloat(t[12]):parseFloat(t[4])),"y"===a&&(r=window.WebKitCSSMatrix?i.m42:16===t.length?parseFloat(t[13]):parseFloat(t[5])),h.rtl&&r&&(r=-r),r||0)},h.getWrapperTranslate=function(e){return void 0===e&&(e=i()?"x":"y"),h.getTranslate(h.wrapper[0],e)},h.observers=[],h.initObservers=function(){if(h.params.observeParents)for(var e=h.container.parents(),a=0;a<e.length;a++)l(e[a]);l(h.container[0],{childList:!1}),l(h.wrapper[0],{attributes:!1})},h.disconnectObservers=function(){for(var e=0;e<h.observers.length;e++)h.observers[e].disconnect();h.observers=[]},h.createLoop=function(){h.wrapper.children("."+h.params.slideClass+"."+h.params.slideDuplicateClass).remove();var e=h.wrapper.children("."+h.params.slideClass);h.loopedSlides=parseInt(h.params.loopedSlides||h.params.slidesPerView,10),h.loopedSlides=h.loopedSlides+h.params.loopAdditionalSlides,h.loopedSlides>e.length&&(h.loopedSlides=e.length);var a,t=[],r=[];for(e.each(function(a,s){var i=$(this);a<h.loopedSlides&&r.push(s),a<e.length&&a>=e.length-h.loopedSlides&&t.push(s),i.attr("data-swiper-slide-index",a)}),a=0;a<r.length;a++)h.wrapper.append($(r[a].cloneNode(!0)).addClass(h.params.slideDuplicateClass));for(a=t.length-1;a>=0;a--)h.wrapper.prepend($(t[a].cloneNode(!0)).addClass(h.params.slideDuplicateClass))},h.destroyLoop=function(){h.wrapper.children("."+h.params.slideClass+"."+h.params.slideDuplicateClass).remove(),h.slides.removeAttr("data-swiper-slide-index")},h.fixLoop=function(){var e;h.activeIndex<h.loopedSlides?(e=h.slides.length-3*h.loopedSlides+h.activeIndex,e+=h.loopedSlides,h.slideTo(e,0,!1,!0)):("auto"===h.params.slidesPerView&&h.activeIndex>=2*h.loopedSlides||h.activeIndex>h.slides.length-2*h.params.slidesPerView)&&(e=-h.slides.length+h.activeIndex+h.loopedSlides,e+=h.loopedSlides,h.slideTo(e,0,!1,!0))},h.appendSlide=function(e){if(h.params.loop&&h.destroyLoop(),"object"===(void 0===e?"undefined":r(e))&&e.length)for(var a=0;a<e.length;a++)e[a]&&h.wrapper.append(e[a]);else h.wrapper.append(e);h.params.loop&&h.createLoop(),h.params.observer&&h.support.observer||h.update(!0)},h.prependSlide=function(e){h.params.loop&&h.destroyLoop();var a=h.activeIndex+1;if("object"===(void 0===e?"undefined":r(e))&&e.length){for(var t=0;t<e.length;t++)e[t]&&h.wrapper.prepend(e[t]);a=h.activeIndex+e.length}else h.wrapper.prepend(e);h.params.loop&&h.createLoop(),h.params.observer&&h.support.observer||h.update(!0),h.slideTo(a,0,!1)},h.removeSlide=function(e){h.params.loop&&h.destroyLoop();var a,t=h.activeIndex;if("object"===(void 0===e?"undefined":r(e))&&e.length){for(var s=0;s<e.length;s++)a=e[s],h.slides[a]&&h.slides.eq(a).remove(),a<t&&t--;t=Math.max(t,0)}else a=e,h.slides[a]&&h.slides.eq(a).remove(),a<t&&t--,t=Math.max(t,0);h.params.observer&&h.support.observer||h.update(!0),h.slideTo(t,0,!1)},h.removeAllSlides=function(){for(var e=[],a=0;a<h.slides.length;a++)e.push(a);h.removeSlide(e)},h.effects={fade:{fadeIndex:null,setTranslate:function(){for(var e=0;e<h.slides.length;e++){var a=h.slides.eq(e),t=a[0].swiperSlideOffset,r=-t;h.params.virtualTranslate||(r-=h.translate);var s=0;i()||(s=r,r=0);var n=h.params.fade.crossFade?Math.max(1-Math.abs(a[0].progress),0):1+Math.min(Math.max(a[0].progress,-1),0);n>0&&n<1&&(h.effects.fade.fadeIndex=e),a.css({opacity:n}).transform("translate3d("+r+"px, "+s+"px, 0px)")}},setTransition:function(e){if(h.slides.transition(e),h.params.virtualTranslate&&0!==e){var a=null!==h.effects.fade.fadeIndex?h.effects.fade.fadeIndex:h.activeIndex;h.slides.eq(a).transitionEnd(function(){for(var e=["webkitTransitionEnd","transitionend","oTransitionEnd","MSTransitionEnd","msTransitionEnd"],a=0;a<e.length;a++)h.wrapper.trigger(e[a])})}}},cube:{setTranslate:function(){var e,a=0;h.params.cube.shadow&&(i()?(e=h.wrapper.find(".swiper-cube-shadow"),0===e.length&&(e=$('<div class="swiper-cube-shadow"></div>'),h.wrapper.append(e)),e.css({height:h.width+"px"})):(e=h.container.find(".swiper-cube-shadow"),0===e.length&&(e=$('<div class="swiper-cube-shadow"></div>'),h.container.append(e))));for(var t=0;t<h.slides.length;t++){var r=h.slides.eq(t),s=90*t,n=Math.floor(s/360);h.rtl&&(s=-s,n=Math.floor(-s/360));var o=Math.max(Math.min(r[0].progress,1),-1),l=0,p=0,d=0;t%4==0?(l=4*-n*h.size,d=0):(t-1)%4==0?(l=0,d=4*-n*h.size):(t-2)%4==0?(l=h.size+4*n*h.size,d=h.size):(t-3)%4==0&&(l=-h.size,d=3*h.size+4*h.size*n),h.rtl&&(l=-l),i()||(p=l,l=0);var c="rotateX("+(i()?0:-s)+"deg) rotateY("+(i()?s:0)+"deg) translate3d("+l+"px, "+p+"px, "+d+"px)";if(o<=1&&o>-1&&(a=90*t+90*o,h.rtl&&(a=90*-t-90*o)),r.transform(c),h.params.cube.slideShadows){var u=i()?r.find(".swiper-slide-shadow-left"):r.find(".swiper-slide-shadow-top"),m=i()?r.find(".swiper-slide-shadow-right"):r.find(".swiper-slide-shadow-bottom");0===u.length&&(u=$('<div class="swiper-slide-shadow-'+(i()?"left":"top")+'"></div>'),r.append(u)),0===m.length&&(m=$('<div class="swiper-slide-shadow-'+(i()?"right":"bottom")+'"></div>'),r.append(m)),u.length&&(u[0].style.opacity=-r[0].progress),m.length&&(m[0].style.opacity=r[0].progress)}}if(h.wrapper.css({"-webkit-transform-origin":"50% 50% -"+h.size/2+"px","-moz-transform-origin":"50% 50% -"+h.size/2+"px","-ms-transform-origin":"50% 50% -"+h.size/2+"px","transform-origin":"50% 50% -"+h.size/2+"px"}),h.params.cube.shadow)if(i())e.transform("translate3d(0px, "+(h.width/2+h.params.cube.shadowOffset)+"px, "+-h.width/2+"px) rotateX(90deg) rotateZ(0deg) scale("+h.params.cube.shadowScale+")");else{var f=Math.abs(a)-90*Math.floor(Math.abs(a)/90),v=1.5-(Math.sin(2*f*Math.PI/360)/2+Math.cos(2*f*Math.PI/360)/2),g=h.params.cube.shadowScale,w=h.params.cube.shadowScale/v,b=h.params.cube.shadowOffset;e.transform("scale3d("+g+", 1, "+w+") translate3d(0px, "+(h.height/2+b)+"px, "+-h.height/2/w+"px) rotateX(-90deg)")}var x=h.isSafari||h.isUiWebView?-h.size/2:0;h.wrapper.transform("translate3d(0px,0,"+x+"px) rotateX("+(i()?0:a)+"deg) rotateY("+(i()?-a:0)+"deg)")},setTransition:function(e){h.slides.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e),h.params.cube.shadow&&!i()&&h.container.find(".swiper-cube-shadow").transition(e)}},coverflow:{setTranslate:function(){for(var e=h.translate,a=i()?-e+h.width/2:-e+h.height/2,t=i()?h.params.coverflow.rotate:-h.params.coverflow.rotate,r=h.params.coverflow.depth,s=0,n=h.slides.length;s<n;s++){var o=h.slides.eq(s),l=h.slidesSizesGrid[s],p=o[0].swiperSlideOffset,d=(a-p-l/2)/l*h.params.coverflow.modifier,c=i()?t*d:0,u=i()?0:t*d,m=-r*Math.abs(d),f=i()?0:h.params.coverflow.stretch*d,v=i()?h.params.coverflow.stretch*d:0;Math.abs(v)<.001&&(v=0),Math.abs(f)<.001&&(f=0),Math.abs(m)<.001&&(m=0),Math.abs(c)<.001&&(c=0),Math.abs(u)<.001&&(u=0);var g="translate3d("+v+"px,"+f+"px,"+m+"px) rotateX("+u+"deg) rotateY("+c+"deg)";if(o.transform(g),o[0].style.zIndex=1-Math.abs(Math.round(d)),h.params.coverflow.slideShadows){var w=i()?o.find(".swiper-slide-shadow-left"):o.find(".swiper-slide-shadow-top"),b=i()?o.find(".swiper-slide-shadow-right"):o.find(".swiper-slide-shadow-bottom");0===w.length&&(w=$('<div class="swiper-slide-shadow-'+(i()?"left":"top")+'"></div>'),o.append(w)),0===b.length&&(b=$('<div class="swiper-slide-shadow-'+(i()?"right":"bottom")+'"></div>'),o.append(b)),w.length&&(w[0].style.opacity=d>0?d:0),b.length&&(b[0].style.opacity=-d>0?-d:0)}}if(h.browser.ie){h.wrapper[0].style.perspectiveOrigin=a+"px 50%"}},setTransition:function(e){h.slides.transition(e).find(".swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left").transition(e)}}},h.lazy={initialImageLoaded:!1,loadImageInSlide:function(e){if(void 0!==e&&0!==h.slides.length){var a=h.slides.eq(e),t=a.find("img.swiper-lazy:not(.swiper-lazy-loaded):not(.swiper-lazy-loading)");0!==t.length&&t.each(function(){var e=$(this);e.addClass("swiper-lazy-loading");var t=e.attr("data-src");h.loadImage(e[0],t,!1,function(){e.attr("src",t),e.removeAttr("data-src"),e.addClass("swiper-lazy-loaded").removeClass("swiper-lazy-loading"),h.emit("onLazyImageReady",h,a[0],e[0])}),h.emit("onLazyImageLoad",h,a[0],e[0])})}},load:function(){if(h.params.watchSlidesVisibility)h.wrapper.children("."+h.params.slideVisibleClass).each(function(){h.lazy.loadImageInSlide($(this).index())});else if(h.params.slidesPerView>1)for(var e=h.activeIndex;e<h.activeIndex+h.params.slidesPerView;e++)h.slides[e]&&h.lazy.loadImageInSlide(e);else h.lazy.loadImageInSlide(h.activeIndex);if(h.params.lazyLoadingInPrevNext){var a=h.wrapper.children("."+h.params.slideNextClass);a.length>0&&h.lazy.loadImageInSlide(a.index());var t=h.wrapper.children("."+h.params.slidePrevClass);t.length>0&&h.lazy.loadImageInSlide(t.index())}},onTransitionStart:function(){h.params.lazyLoading&&(h.params.lazyLoadingOnTransitionStart||!h.params.lazyLoadingOnTransitionStart&&!h.lazy.initialImageLoaded)&&(h.lazy.initialImageLoaded=!0,h.lazy.load())},onTransitionEnd:function(){h.params.lazyLoading&&!h.params.lazyLoadingOnTransitionStart&&h.lazy.load()}},h.scrollbar={set:function(){if(h.params.scrollbar){var e=h.scrollbar;e.track=$(h.params.scrollbar),e.drag=e.track.find(".swiper-scrollbar-drag"),0===e.drag.length&&(e.drag=$('<div class="swiper-scrollbar-drag"></div>'),e.track.append(e.drag)),e.drag[0].style.width="",e.drag[0].style.height="",e.trackSize=i()?e.track[0].offsetWidth:e.track[0].offsetHeight,e.divider=h.size/h.virtualSize,e.moveDivider=e.divider*(e.trackSize/h.size),e.dragSize=e.trackSize*e.divider,i()?e.drag[0].style.width=e.dragSize+"px":e.drag[0].style.height=e.dragSize+"px",e.divider>=1?e.track[0].style.display="none":e.track[0].style.display="",h.params.scrollbarHide&&(e.track[0].style.opacity=0)}},setTranslate:function(){if(h.params.scrollbar){var e,a=h.scrollbar,t=a.dragSize;e=(a.trackSize-a.dragSize)*h.progress,h.rtl&&i()?(e=-e,e>0?(t=a.dragSize-e,e=0):-e+a.dragSize>a.trackSize&&(t=a.trackSize+e)):e<0?(t=a.dragSize+e,e=0):e+a.dragSize>a.trackSize&&(t=a.trackSize-e),i()?(h.support.transforms3d?a.drag.transform("translate3d("+e+"px, 0, 0)"):a.drag.transform("translateX("+e+"px)"),a.drag[0].style.width=t+"px"):(h.support.transforms3d?a.drag.transform("translate3d(0px, "+e+"px, 0)"):a.drag.transform("translateY("+e+"px)"),a.drag[0].style.height=t+"px"),h.params.scrollbarHide&&(clearTimeout(a.timeout),a.track[0].style.opacity=1,a.timeout=setTimeout(function(){a.track[0].style.opacity=0,a.track.transition(400)},1e3))}},setTransition:function(e){h.params.scrollbar&&h.scrollbar.drag.transition(e)}},h.controller={setTranslate:function(a,t){var r,s,i=h.params.control;if(h.isArray(i))for(var n=0;n<i.length;n++)i[n]!==t&&i[n]instanceof e&&(a=i[n].rtl&&"horizontal"===i[n].params.direction?-h.translate:h.translate,r=(i[n].maxTranslate()-i[n].minTranslate())/(h.maxTranslate()-h.minTranslate()),s=(a-h.minTranslate())*r+i[n].minTranslate(),h.params.controlInverse&&(s=i[n].maxTranslate()-s),i[n].updateProgress(s),i[n].setWrapperTranslate(s,!1,h),i[n].updateActiveIndex());else i instanceof e&&t!==i&&(a=i.rtl&&"horizontal"===i.params.direction?-h.translate:h.translate,r=(i.maxTranslate()-i.minTranslate())/(h.maxTranslate()-h.minTranslate()),s=(a-h.minTranslate())*r+i.minTranslate(),h.params.controlInverse&&(s=i.maxTranslate()-s),i.updateProgress(s),i.setWrapperTranslate(s,!1,h),i.updateActiveIndex())},setTransition:function(a,t){var r=h.params.control;if(h.isArray(r))for(var s=0;s<r.length;s++)r[s]!==t&&r[s]instanceof e&&r[s].setWrapperTransition(a,h);else r instanceof e&&t!==r&&r.setWrapperTransition(a,h)}},h.parallax={setTranslate:function(){h.container.children("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]").each(function(){p(this,h.progress)}),h.slides.each(function(){var e=$(this);e.find("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]").each(function(){p(this,Math.min(Math.max(e[0].progress,-1),1))})})},setTransition:function(e){void 0===e&&(e=h.params.speed),h.container.find("[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]").each(function(){var a=$(this),t=parseInt(a.attr("data-swiper-parallax-duration"),10)||e;0===e&&(t=0),a.transition(t)})}},h._plugins=[];for(var L in h.plugins)if(h.plugins.hasOwnProperty(L)){var B=h.plugins[L](h,h.params[L]);B&&h._plugins.push(B)}return h.callPlugins=function(e){for(var a=0;a<h._plugins.length;a++)e in h._plugins[a]&&h._plugins[a][e](arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])},h.emitterEventListeners={},h.emit=function(e){h.params[e]&&h.params[e](arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]);var a;if(h){if(h.emitterEventListeners[e])for(a=0;a<h.emitterEventListeners[e].length;a++)h.emitterEventListeners[e][a](arguments[1],arguments[2],arguments[3],arguments[4],arguments[5]);h.callPlugins&&h.callPlugins(e,arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])}},h.on=function(e,a){return e=d(e),h.emitterEventListeners[e]||(h.emitterEventListeners[e]=[]),h.emitterEventListeners[e].push(a),h},h.off=function(e,a){var t;if(e=d(e),void 0===a)return h.emitterEventListeners[e]=[],h;if(h.emitterEventListeners[e]&&0!==h.emitterEventListeners[e].length){for(t=0;t<h.emitterEventListeners[e].length;t++)h.emitterEventListeners[e][t]===a&&h.emitterEventListeners[e].splice(t,1);return h}},h.once=function(e,a){e=d(e);var t=function t(){a(arguments[0],arguments[1],arguments[2],arguments[3],arguments[4]),h.off(e,t)};return h.on(e,t),h},h.a11y={makeFocusable:function(e){return e[0].tabIndex="0",e},addRole:function(e,a){return e.attr("role",a),e},addLabel:function(e,a){return e.attr("aria-label",a),e},disable:function(e){return e.attr("aria-disabled",!0),e},enable:function(e){return e.attr("aria-disabled",!1),e},onEnterKey:function(e){13===e.keyCode&&($(e.target).is(h.params.nextButton)?(h.onClickNext(e),h.isEnd?h.a11y.notify(h.params.lastSlideMsg):h.a11y.notify(h.params.nextSlideMsg)):$(e.target).is(h.params.prevButton)&&(h.onClickPrev(e),h.isBeginning?h.a11y.notify(h.params.firstSlideMsg):h.a11y.notify(h.params.prevSlideMsg)))},liveRegion:$('<span class="swiper-notification" aria-live="assertive" aria-atomic="true"></span>'),notify:function(e){var a=h.a11y.liveRegion;0!==a.length&&(a.html(""),a.html(e))},init:function(){if(h.params.nextButton){var e=$(h.params.nextButton);h.a11y.makeFocusable(e),h.a11y.addRole(e,"button"),h.a11y.addLabel(e,h.params.nextSlideMsg)}if(h.params.prevButton){var a=$(h.params.prevButton);h.a11y.makeFocusable(a),h.a11y.addRole(a,"button"),h.a11y.addLabel(a,h.params.prevSlideMsg)}$(h.container).append(h.a11y.liveRegion)},destroy:function(){h.a11y.liveRegion&&h.a11y.liveRegion.length>0&&h.a11y.liveRegion.remove()}},h.init=function(){h.params.loop&&h.createLoop(),h.updateContainerSize(),h.updateSlidesSize(),h.updatePagination(),h.params.scrollbar&&h.scrollbar&&h.scrollbar.set(),"slide"!==h.params.effect&&h.effects[h.params.effect]&&(h.params.loop||h.updateProgress(),h.effects[h.params.effect].setTranslate()),h.params.loop?h.slideTo(h.params.initialSlide+h.loopedSlides,0,h.params.runCallbacksOnInit):(h.slideTo(h.params.initialSlide,0,h.params.runCallbacksOnInit),0===h.params.initialSlide&&(h.parallax&&h.params.parallax&&h.parallax.setTranslate(),h.lazy&&h.params.lazyLoading&&h.lazy.load())),h.attachEvents(),h.params.observer&&h.support.observer&&h.initObservers(),h.params.preloadImages&&!h.params.lazyLoading&&h.preloadImages(),h.params.autoplay&&h.startAutoplay(),h.params.keyboardControl&&h.enableKeyboardControl&&h.enableKeyboardControl(),h.params.mousewheelControl&&h.enableMousewheelControl&&h.enableMousewheelControl(),h.params.hashnav&&h.hashnav&&h.hashnav.init(),h.params.a11y&&h.a11y&&h.a11y.init(),h.emit("onInit",h)},h.cleanupStyles=function(){h.container.removeClass(h.classNames.join(" ")).removeAttr("style"),h.wrapper.removeAttr("style"),h.slides&&h.slides.length&&h.slides.removeClass([h.params.slideVisibleClass,h.params.slideActiveClass,h.params.slideNextClass,h.params.slidePrevClass].join(" ")).removeAttr("style").removeAttr("data-swiper-column").removeAttr("data-swiper-row"),h.paginationContainer&&h.paginationContainer.length&&h.paginationContainer.removeClass(h.params.paginationHiddenClass),h.bullets&&h.bullets.length&&h.bullets.removeClass(h.params.bulletActiveClass),h.params.prevButton&&$(h.params.prevButton).removeClass(h.params.buttonDisabledClass),h.params.nextButton&&$(h.params.nextButton).removeClass(h.params.buttonDisabledClass),h.params.scrollbar&&h.scrollbar&&(h.scrollbar.track&&h.scrollbar.track.length&&h.scrollbar.track.removeAttr("style"),h.scrollbar.drag&&h.scrollbar.drag.length&&h.scrollbar.drag.removeAttr("style"))},h.destroy=function(e,a){h.detachEvents(),h.stopAutoplay(),h.params.loop&&h.destroyLoop(),a&&h.cleanupStyles(),h.disconnectObservers(),h.params.keyboardControl&&h.disableKeyboardControl&&h.disableKeyboardControl(),h.params.mousewheelControl&&h.disableMousewheelControl&&h.disableMousewheelControl(),h.params.a11y&&h.a11y&&h.a11y.destroy(),h.emit("onDestroy"),!1!==e&&(h=null)},h.container.css("min-height","1px"),s(h.container[0],c),h}};i.prototype={defaults:{direction:"horizontal",touchEventsTarget:"container",initialSlide:0,speed:300,autoplay:!1,autoplayDisableOnInteraction:!0,freeMode:!1,freeModeMomentum:!0,freeModeMomentumRatio:1,freeModeMomentumBounce:!0,freeModeMomentumBounceRatio:1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",coverflow:{rotate:50,stretch:0,depth:100,modifier:1,slideShadows:!0},cube:{slideShadows:!0,shadow:!0,shadowOffset:20,shadowScale:.94},fade:{crossFade:!1},parallax:!1,scrollbar:null,scrollbarHide:!0,keyboardControl:!1,mousewheelControl:!1,mousewheelForceToAxis:!1,hashnav:!1,spaceBetween:0,slidesPerView:1,slidesPerColumn:1,slidesPerColumnFill:"column",slidesPerGroup:1,centeredSlides:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,onlyExternal:!1,threshold:0,touchMoveStopPropagation:!0,pagination:null,paginationClickable:!1,paginationHide:!1,paginationBulletRender:null,resistance:!0,resistanceRatio:.85,nextButton:null,prevButton:null,watchSlidesProgress:!1,watchSlidesVisibility:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,lazyLoading:!1,lazyLoadingInPrevNext:!1,lazyLoadingOnTransitionStart:!1,preloadImages:!0,updateOnImagesReady:!0,loop:!1,loopAdditionalSlides:0,loopedSlides:null,control:void 0,controlInverse:!1,allowSwipeToPrev:!0,allowSwipeToNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",slideClass:"swiper-slide",slideActiveClass:"swiper-slide-active",slideVisibleClass:"swiper-slide-visible",slideDuplicateClass:"swiper-slide-duplicate",slideNextClass:"swiper-slide-next",slidePrevClass:"swiper-slide-prev",wrapperClass:"swiper-wrapper",bulletClass:"swiper-pagination-bullet",bulletActiveClass:"swiper-pagination-bullet-active",buttonDisabledClass:"swiper-button-disabled",paginationHiddenClass:"swiper-pagination-hidden",observer:!1,observeParents:!1,a11y:!1,prevSlideMessage:"Previous slide",nextSlideMessage:"Next slide",firstSlideMessage:"This is the first slide",lastSlideMessage:"This is the last slide",runCallbacksOnInit:!0},isSafari:function(){var e=navigator.userAgent.toLowerCase();return e.indexOf("safari")>=0&&e.indexOf("chrome")<0&&e.indexOf("android")<0}(),isUiWebView:/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent),isArray:function(e){return"[object Array]"===Object.prototype.toString.apply(e)},browser:{ie:window.navigator.pointerEnabled||window.navigator.msPointerEnabled,ieTouch:window.navigator.msPointerEnabled&&window.navigator.msMaxTouchPoints>1||window.navigator.pointerEnabled&&window.navigator.maxTouchPoints>1},device:function(){var e=navigator.userAgent,a=e.match(/(Android);?[\s\/]+([\d.]+)?/),t=e.match(/(iPad).*OS\s([\d_]+)/),r=!t&&e.match(/(iPhone\sOS)\s([\d_]+)/);return{ios:t||r||t,android:a}}(),support:{touch:window.Modernizr&&!0===Modernizr.touch||function(){return!!("ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch)}(),transforms3d:window.Modernizr&&!0===Modernizr.csstransforms3d||function(){var e=document.createElement("div").style;return"webkitPerspective"in e||"MozPerspective"in e||"OPerspective"in e||"MsPerspective"in e||"perspective"in e}(),flexbox:function(){for(var e=document.createElement("div").style,a="alignItems webkitAlignItems webkitBoxAlign msFlexAlign mozBoxAlign webkitFlexDirection msFlexDirection mozBoxDirection mozBoxOrient webkitBoxDirection webkitBoxOrient".split(" "),t=0;t<a.length;t++)if(a[t]in e)return!0}(),observer:function(){return"MutationObserver"in window||"WebkitMutationObserver"in window}()},plugins:{}};var n=function(e,a){return new i(e,a)};a.swiper=n}})});