1/** 2 * Swiper 5.2.1 3 * Most modern mobile touch slider and framework with hardware accelerated transitions 4 * http://swiperjs.com 5 * 6 * Copyright 2014-2019 Vladimir Kharlampidi 7 * 8 * Released under the MIT License 9 * 10 * Released on: Novem
vendor: 16,278 bytes, lines 10-540
10ber 16, 2019 11 */ 12 13(function (global, factory) { 14 typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : 15 typeof define === 'function' && define.amd ? define(factory) : 16 (global = global || self, global.Swiper = factory()); 17}(this, function () { 'use strict'; 18 19 /** 20 * SSR Window 1.0.1 21 * Better handling for window object in SSR environment 22 * https://github.com/nolimits4web/ssr-window 23 * 24 * Copyright 2018, Vladimir Kharlampidi 25 * 26 * Licensed under MIT 27 * 28 * Released on: July 18, 2018 29 */ 30 var doc = (typeof document === 'undefined') ? { 31 body: {}, 32 addEventListener: function addEventListener() {}, 33 removeEventListener: function removeEventListener() {}, 34 activeElement: { 35 blur: function blur() {}, 36 nodeName: '', 37 }, 38 querySelector: function querySelector() { 39 return null; 40 }, 41 querySelectorAll: function querySelectorAll() { 42 return []; 43 }, 44 getElementById: function getElementById() { 45 return null; 46 }, 47 createEvent: function createEvent() { 48 return { 49 initEvent: function initEvent() {}, 50 }; 51 }, 52 createElement: function createElement() { 53 return { 54 children: [], 55 childNodes: [], 56 style: {}, 57 setAttribute: function setAttribute() {}, 58 getElementsByTagName: function getElementsByTagName() { 59 return []; 60 }, 61 }; 62 }, 63 location: { hash: '' }, 64 } : document; // eslint-disable-line 65 66 var win = (typeof window === 'undefined') ? { 67 document: doc, 68 navigator: { 69 userAgent: '', 70 }, 71 location: {}, 72 history: {}, 73 CustomEvent: function CustomEvent() { 74 return this; 75 }, 76 addEventListener: function addEventListener() {}, 77 removeEventListener: function removeEventListener() {}, 78 getComputedStyle: function getComputedStyle() { 79 return { 80 getPropertyValue: function getPropertyValue() { 81 return ''; 82 }, 83 }; 84 }, 85 Image: function Image() {}, 86 Date: function Date() {}, 87 screen: {}, 88 setTimeout: function setTimeout() {}, 89 clearTimeout: function clearTimeout() {}, 90 } : window; // eslint-disable-line 91 92 /** 93 * Dom7 2.1.3 94 * Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API 95 * http://framework7.io/docs/dom.html 96 * 97 * Copyright 2019, Vladimir Kharlampidi 98 * The iDangero.us 99 * http://www.idangero.us/ 100 * 101 * Licensed under MIT 102 * 103 * Released on: February 11, 2019 104 */ 105 106 var Dom7 = function Dom7(arr) { 107 var self = this; 108 // Create array-like object 109 for (var i = 0; i < arr.length; i += 1) { 110 self[i] = arr[i]; 111 } 112 self.length = arr.length; 113 // Return collection with methods 114 return this; 115 }; 116 117 function $(selector, context) { 118 var arr = []; 119 var i = 0; 120 if (selector && !context) { 121 if (selector instanceof Dom7) { 122 return selector; 123 } 124 } 125 if (selector) { 126 // String 127 if (typeof selector === 'string') { 128 var els; 129 var tempParent; 130 var html = selector.trim(); 131 if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) { 132 var toCreate = 'div'; 133 if (html.indexOf('<li') === 0) { toCreate = 'ul'; } 134 if (html.indexOf('<tr') === 0) { toCreate = 'tbody'; } 135 if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) { toCreate = 'tr'; } 136 if (html.indexOf('<tbody') === 0) { toCreate = 'table'; } 137 if (html.indexOf('<option') === 0) { toCreate = 'select'; } 138 tempParent = doc.createElement(toCreate); 139 tempParent.innerHTML = html; 140 for (i = 0; i < tempParent.childNodes.length; i += 1) { 141 arr.push(tempParent.childNodes[i]); 142 } 143 } else { 144 if (!context && selector[0] === '#' && !selector.match(/[ .<>:~]/)) { 145 // Pure ID selector 146 els = [doc.getElementById(selector.trim().split('#')[1])]; 147 } else { 148 // Other selectors 149 els = (context || doc).querySelectorAll(selector.trim()); 150 } 151 for (i = 0; i < els.length; i += 1) { 152 if (els[i]) { arr.push(els[i]); } 153 } 154 } 155 } else if (selector.nodeType || selector === win || selector === doc) { 156 // Node/element 157 arr.push(selector); 158 } else if (selector.length > 0 && selector[0].nodeType) { 159 // Array of elements or instance of Dom 160 for (i = 0; i < selector.length; i += 1) { 161 arr.push(selector[i]); 162 } 163 } 164 } 165 return new Dom7(arr); 166 } 167 168 $.fn = Dom7.prototype; 169 $.Class = Dom7; 170 $.Dom7 = Dom7; 171 172 function unique(arr) { 173 var uniqueArray = []; 174 for (var i = 0; i < arr.length; i += 1) { 175 if (uniqueArray.indexOf(arr[i]) === -1) { uniqueArray.push(arr[i]); } 176 } 177 return uniqueArray; 178 } 179 180 // Classes and attributes 181 function addClass(className) { 182 if (typeof className === 'undefined') { 183 return this; 184 } 185 var classes = className.split(' '); 186 for (var i = 0; i < classes.length; i += 1) { 187 for (var j = 0; j < this.length; j += 1) { 188 if (typeof this[j] !== 'undefined' && typeof this[j].classList !== 'undefined') { this[j].classList.add(classes[i]); } 189 } 190 } 191 return this; 192 } 193 function removeClass(className) { 194 var classes = className.split(' '); 195 for (var i = 0; i < classes.length; i += 1) { 196 for (var j = 0; j < this.length; j += 1) { 197 if (typeof this[j] !== 'undefined' && typeof this[j].classList !== 'undefined') { this[j].classList.remove(classes[i]); } 198 } 199 } 200 return this; 201 } 202 function hasClass(className) { 203 if (!this[0]) { return false; } 204 return this[0].classList.contains(className); 205 } 206 function toggleClass(className) { 207 var classes = className.split(' '); 208 for (var i = 0; i < classes.length; i += 1) { 209 for (var j = 0; j < this.length; j += 1) { 210 if (typeof this[j] !== 'undefined' && typeof this[j].classList !== 'undefined') { this[j].classList.toggle(classes[i]); } 211 } 212 } 213 return this; 214 } 215 function attr(attrs, value) { 216 var arguments$1 = arguments; 217 218 if (arguments.length === 1 && typeof attrs === 'string') { 219 // Get attr 220 if (this[0]) { return this[0].getAttribute(attrs); } 221 return undefined; 222 } 223 224 // Set attrs 225 for (var i = 0; i < this.length; i += 1) { 226 if (arguments$1.length === 2) { 227 // String 228 this[i].setAttribute(attrs, value); 229 } else { 230 // Object 231 // eslint-disable-next-line 232 for (var attrName in attrs) { 233 this[i][attrName] = attrs[attrName]; 234 this[i].setAttribute(attrName, attrs[attrName]); 235 } 236 } 237 } 238 return this; 239 } 240 // eslint-disable-next-line 241 function removeAttr(attr) { 242 for (var i = 0; i < this.length; i += 1) { 243 this[i].removeAttribute(attr); 244 } 245 return this; 246 } 247 function data(key, value) { 248 var el; 249 if (typeof value === 'undefined') { 250 el = this[0]; 251 // Get value 252 if (el) { 253 if (el.dom7ElementDataStorage && (key in el.dom7ElementDataStorage)) { 254 return el.dom7ElementDataStorage[key]; 255 } 256 257 var dataKey = el.getAttribute(("data-" + key)); 258 if (dataKey) { 259 return dataKey; 260 } 261 return undefined; 262 } 263 return undefined; 264 } 265 266 // Set value 267 for (var i = 0; i < this.length; i += 1) { 268 el = this[i]; 269 if (!el.dom7ElementDataStorage) { el.dom7ElementDataStorage = {}; } 270 el.dom7ElementDataStorage[key] = value; 271 } 272 return this; 273 } 274 // Transforms 275 // eslint-disable-next-line 276 function transform(transform) { 277 for (var i = 0; i < this.length; i += 1) { 278 var elStyle = this[i].style; 279 elStyle.webkitTransform = transform; 280 elStyle.transform = transform; 281 } 282 return this; 283 } 284 function transition(duration) { 285 if (typeof duration !== 'string') { 286 duration = duration + "ms"; // eslint-disable-line 287 } 288 for (var i = 0; i < this.length; i += 1) { 289 var elStyle = this[i].style; 290 elStyle.webkitTransitionDuration = duration; 291 elStyle.transitionDuration = duration; 292 } 293 return this; 294 } 295 // Events 296 function on() { 297 var assign; 298 299 var args = [], len = arguments.length; 300 while ( len-- ) args[ len ] = arguments[ len ]; 301 var eventType = args[0]; 302 var targetSelector = args[1]; 303 var listener = args[2]; 304 var capture = args[3]; 305 if (typeof args[1] === 'function') { 306 (assign = args, eventType = assign[0], listener = assign[1], capture = assign[2]); 307 targetSelector = undefined; 308 } 309 if (!capture) { capture = false; } 310 311 function handleLiveEvent(e) { 312 var target = e.target; 313 if (!target) { return; } 314 var eventData = e.target.dom7EventData || []; 315 if (eventData.indexOf(e) < 0) { 316 eventData.unshift(e); 317 } 318 if ($(target).is(targetSelector)) { listener.apply(target, eventData); } 319 else { 320 var parents = $(target).parents(); // eslint-disable-line 321 for (var k = 0; k < parents.length; k += 1) { 322 if ($(parents[k]).is(targetSelector)) { listener.apply(parents[k], eventData); } 323 } 324 } 325 } 326 function handleEvent(e) { 327 var eventData = e && e.target ? e.target.dom7EventData || [] : []; 328 if (eventData.indexOf(e) < 0) { 329 eventData.unshift(e); 330 } 331 listener.apply(this, eventData); 332 } 333 var events = eventType.split(' '); 334 var j; 335 for (var i = 0; i < this.length; i += 1) { 336 var el = this[i]; 337 if (!targetSelector) { 338 for (j = 0; j < events.length; j += 1) { 339 var event = events[j]; 340 if (!el.dom7Listeners) { el.dom7Listeners = {}; } 341 if (!el.dom7Listeners[event]) { el.dom7Listeners[event] = []; } 342 el.dom7Listeners[event].push({ 343 listener: listener, 344 proxyListener: handleEvent, 345 }); 346 el.addEventListener(event, handleEvent, capture); 347 } 348 } else { 349 // Live events 350 for (j = 0; j < events.length; j += 1) { 351 var event$1 = events[j]; 352 if (!el.dom7LiveListeners) { el.dom7LiveListeners = {}; } 353 if (!el.dom7LiveListeners[event$1]) { el.dom7LiveListeners[event$1] = []; } 354 el.dom7LiveListeners[event$1].push({ 355 listener: listener, 356 proxyListener: handleLiveEvent, 357 }); 358 el.addEventListener(event$1, handleLiveEvent, capture); 359 } 360 } 361 } 362 return this; 363 } 364 function off() { 365 var assign; 366 367 var args = [], len = arguments.length; 368 while ( len-- ) args[ len ] = arguments[ len ]; 369 var eventType = args[0]; 370 var targetSelector = args[1]; 371 var listener = args[2]; 372 var capture = args[3]; 373 if (typeof args[1] === 'function') { 374 (assign = args, eventType = assign[0], listener = assign[1], capture = assign[2]); 375 targetSelector = undefined; 376 } 377 if (!capture) { capture = false; } 378 379 var events = eventType.split(' '); 380 for (var i = 0; i < events.length; i += 1) { 381 var event = events[i]; 382 for (var j = 0; j < this.length; j += 1) { 383 var el = this[j]; 384 var handlers = (void 0); 385 if (!targetSelector && el.dom7Listeners) { 386 handlers = el.dom7Listeners[event]; 387 } else if (targetSelector && el.dom7LiveListeners) { 388 handlers = el.dom7LiveListeners[event]; 389 } 390 if (handlers && handlers.length) { 391 for (var k = handlers.length - 1; k >= 0; k -= 1) { 392 var handler = handlers[k]; 393 if (listener && handler.listener === listener) { 394 el.removeEventListener(event, handler.proxyListener, capture); 395 handlers.splice(k, 1); 396 } else if (listener && handler.listener && handler.listener.dom7proxy && handler.listener.dom7proxy === listener) { 397 el.removeEventListener(event, handler.proxyListener, capture); 398 handlers.splice(k, 1); 399 } else if (!listener) { 400 el.removeEventListener(event, handler.proxyListener, capture); 401 handlers.splice(k, 1); 402 } 403 } 404 } 405 } 406 } 407 return this; 408 } 409 function trigger() { 410 var args = [], len = arguments.length; 411 while ( len-- ) args[ len ] = arguments[ len ]; 412 413 var events = args[0].split(' '); 414 var eventData = args[1]; 415 for (var i = 0; i < events.length; i += 1) { 416 var event = events[i]; 417 for (var j = 0; j < this.length; j += 1) { 418 var el = this[j]; 419 var evt = (void 0); 420 try { 421 evt = new win.CustomEvent(event, { 422 detail: eventData, 423 bubbles: true, 424 cancelable: true, 425 }); 426 } catch (e) { 427 evt = doc.createEvent('Event'); 428 evt.initEvent(event, true, true); 429 evt.detail = eventData; 430 } 431 // eslint-disable-next-line 432 el.dom7EventData = args.filter(function (data, dataIndex) { return dataIndex > 0; }); 433 el.dispatchEvent(evt); 434 el.dom7EventData = []; 435 delete el.dom7EventData; 436 } 437 } 438 return this; 439 } 440 function transitionEnd(callback) { 441 var events = ['webkitTransitionEnd', 'transitionend']; 442 var dom = this; 443 var i; 444 function fireCallBack(e) { 445 /* jshint validthis:true */ 446 if (e.target !== this) { return; } 447 callback.call(this, e); 448 for (i = 0; i < events.length; i += 1) { 449 dom.off(events[i], fireCallBack); 450 } 451 } 452 if (callback) { 453 for (i = 0; i < events.length; i += 1) { 454 dom.on(events[i], fireCallBack); 455 } 456 } 457 return this; 458 } 459 function outerWidth(includeMargins) { 460 if (this.length > 0) { 461 if (includeMargins) { 462 // eslint-disable-next-line 463 var styles = this.styles(); 464 return this[0].offsetWidth + parseFloat(styles.getPropertyValue('margin-right')) + parseFloat(styles.getPropertyValue('margin-left')); 465 } 466 return this[0].offsetWidth; 467 } 468 return null; 469 } 470 function outerHeight(includeMargins) { 471 if (this.length > 0) { 472 if (includeMargins) { 473 // eslint-disable-next-line 474 var styles = this.styles(); 475 return this[0].offsetHeight + parseFloat(styles.getPropertyValue('margin-top')) + parseFloat(styles.getPropertyValue('margin-bottom')); 476 } 477 return this[0].offsetHeight; 478 } 479 return null; 480 } 481 function offset() { 482 if (this.length > 0) { 483 var el = this[0]; 484 var box = el.getBoundingClientRect(); 485 var body = doc.body; 486 var clientTop = el.clientTop || body.clientTop || 0; 487 var clientLeft = el.clientLeft || body.clientLeft || 0; 488 var scrollTop = el === win ? win.scrollY : el.scrollTop; 489 var scrollLeft = el === win ? win.scrollX : el.scrollLeft; 490 return { 491 top: (box.top + scrollTop) - clientTop, 492 left: (box.left + scrollLeft) - clientLeft, 493 }; 494 } 495 496 return null; 497 } 498 function styles() { 499 if (this[0]) { return win.getComputedStyle(this[0], null); } 500 return {}; 501 } 502 function css(props, value) { 503 var i; 504 if (arguments.length === 1) { 505 if (typeof props === 'string') { 506 if (this[0]) { return win.getComputedStyle(this[0], null).getPropertyValue(props); } 507 } else { 508 for (i = 0; i < this.length; i += 1) { 509 // eslint-disable-next-line 510 for (var prop in props) { 511 this[i].style[prop] = props[prop]; 512 } 513 } 514 return this; 515 } 516 } 517 if (arguments.length === 2 && typeof props === 'string') { 518 for (i = 0; i < this.length; i += 1) { 519 this[i].style[props] = value; 520 } 521 return this; 522 } 523 return this; 524 } 525 // Iterate over the collection passing elements to `callback` 526 function each(callback) { 527 // Don't bother continuing without a callback 528 if (!callback) { return this; } 529 // Iterate over the current collection 530 for (var i = 0; i < this.length; i += 1) { 531 // If the callback returns false 532 if (callback.call(this[i], i, this[i]) === false) { 533 // End the loop early 534 return this; 535 } 536 } 537 // Return `this` to allow chained DOM operations 538 return this; 539 } 540
540function filter(callback) { 541 var matchedItems = []; 542 var dom = this; 543 for (var i = 0; i < dom.length; i += 1) {
vendor: 37,545 bytes, lines 544-1631
544 if (callback.call(dom[i], i, dom[i])) { matchedItems.push(dom[i]); } 545 } 546 return new Dom7(matchedItems); 547 } 548 // eslint-disable-next-line 549 function html(html) { 550 if (typeof html === 'undefined') { 551 return this[0] ? this[0].innerHTML : undefined; 552 } 553 554 for (var i = 0; i < this.length; i += 1) { 555 this[i].innerHTML = html; 556 } 557 return this; 558 } 559 // eslint-disable-next-line 560 function text(text) { 561 if (typeof text === 'undefined') { 562 if (this[0]) { 563 return this[0].textContent.trim(); 564 } 565 return null; 566 } 567 568 for (var i = 0; i < this.length; i += 1) { 569 this[i].textContent = text; 570 } 571 return this; 572 } 573 function is(selector) { 574 var el = this[0]; 575 var compareWith; 576 var i; 577 if (!el || typeof selector === 'undefined') { return false; } 578 if (typeof selector === 'string') { 579 if (el.matches) { return el.matches(selector); } 580 else if (el.webkitMatchesSelector) { return el.webkitMatchesSelector(selector); } 581 else if (el.msMatchesSelector) { return el.msMatchesSelector(selector); } 582 583 compareWith = $(selector); 584 for (i = 0; i < compareWith.length; i += 1) { 585 if (compareWith[i] === el) { return true; } 586 } 587 return false; 588 } else if (selector === doc) { return el === doc; } 589 else if (selector === win) { return el === win; } 590 591 if (selector.nodeType || selector instanceof Dom7) { 592 compareWith = selector.nodeType ? [selector] : selector; 593 for (i = 0; i < compareWith.length; i += 1) { 594 if (compareWith[i] === el) { return true; } 595 } 596 return false; 597 } 598 return false; 599 } 600 function index() { 601 var child = this[0]; 602 var i; 603 if (child) { 604 i = 0; 605 // eslint-disable-next-line 606 while ((child = child.previousSibling) !== null) { 607 if (child.nodeType === 1) { i += 1; } 608 } 609 return i; 610 } 611 return undefined; 612 } 613 // eslint-disable-next-line 614 function eq(index) { 615 if (typeof index === 'undefined') { return this; } 616 var length = this.length; 617 var returnIndex; 618 if (index > length - 1) { 619 return new Dom7([]); 620 } 621 if (index < 0) { 622 returnIndex = length + index; 623 if (returnIndex < 0) { return new Dom7([]); } 624 return new Dom7([this[returnIndex]]); 625 } 626 return new Dom7([this[index]]); 627 } 628 function append() { 629 var args = [], len = arguments.length; 630 while ( len-- ) args[ len ] = arguments[ len ]; 631 632 var newChild; 633 634 for (var k = 0; k < args.length; k += 1) { 635 newChild = args[k]; 636 for (var i = 0; i < this.length; i += 1) { 637 if (typeof newChild === 'string') { 638 var tempDiv = doc.createElement('div'); 639 tempDiv.innerHTML = newChild; 640 while (tempDiv.firstChild) { 641 this[i].appendChild(tempDiv.firstChild); 642 } 643 } else if (newChild instanceof Dom7) { 644 for (var j = 0; j < newChild.length; j += 1) { 645 this[i].appendChild(newChild[j]); 646 } 647 } else { 648 this[i].appendChild(newChild); 649 } 650 } 651 } 652 653 return this; 654 } 655 function prepend(newChild) { 656 var i; 657 var j; 658 for (i = 0; i < this.length; i += 1) { 659 if (typeof newChild === 'string') { 660 var tempDiv = doc.createElement('div'); 661 tempDiv.innerHTML = newChild; 662 for (j = tempDiv.childNodes.length - 1; j >= 0; j -= 1) { 663 this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]); 664 } 665 } else if (newChild instanceof Dom7) { 666 for (j = 0; j < newChild.length; j += 1) { 667 this[i].insertBefore(newChild[j], this[i].childNodes[0]); 668 } 669 } else { 670 this[i].insertBefore(newChild, this[i].childNodes[0]); 671 } 672 } 673 return this; 674 } 675 function next(selector) { 676 if (this.length > 0) { 677 if (selector) { 678 if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) { 679 return new Dom7([this[0].nextElementSibling]); 680 } 681 return new Dom7([]); 682 } 683 684 if (this[0].nextElementSibling) { return new Dom7([this[0].nextElementSibling]); } 685 return new Dom7([]); 686 } 687 return new Dom7([]); 688 } 689 function nextAll(selector) { 690 var nextEls = []; 691 var el = this[0]; 692 if (!el) { return new Dom7([]); } 693 while (el.nextElementSibling) { 694 var next = el.nextElementSibling; // eslint-disable-line 695 if (selector) { 696 if ($(next).is(selector)) { nextEls.push(next); } 697 } else { nextEls.push(next); } 698 el = next; 699 } 700 return new Dom7(nextEls); 701 } 702 function prev(selector) { 703 if (this.length > 0) { 704 var el = this[0]; 705 if (selector) { 706 if (el.previousElementSibling && $(el.previousElementSibling).is(selector)) { 707 return new Dom7([el.previousElementSibling]); 708 } 709 return new Dom7([]); 710 } 711 712 if (el.previousElementSibling) { return new Dom7([el.previousElementSibling]); } 713 return new Dom7([]); 714 } 715 return new Dom7([]); 716 } 717 function prevAll(selector) { 718 var prevEls = []; 719 var el = this[0]; 720 if (!el) { return new Dom7([]); } 721 while (el.previousElementSibling) { 722 var prev = el.previousElementSibling; // eslint-disable-line 723 if (selector) { 724 if ($(prev).is(selector)) { prevEls.push(prev); } 725 } else { prevEls.push(prev); } 726 el = prev; 727 } 728 return new Dom7(prevEls); 729 } 730 function parent(selector) { 731 var parents = []; // eslint-disable-line 732 for (var i = 0; i < this.length; i += 1) { 733 if (this[i].parentNode !== null) { 734 if (selector) { 735 if ($(this[i].parentNode).is(selector)) { parents.push(this[i].parentNode); } 736 } else { 737 parents.push(this[i].parentNode); 738 } 739 } 740 } 741 return $(unique(parents)); 742 } 743 function parents(selector) { 744 var parents = []; // eslint-disable-line 745 for (var i = 0; i < this.length; i += 1) { 746 var parent = this[i].parentNode; // eslint-disable-line 747 while (parent) { 748 if (selector) { 749 if ($(parent).is(selector)) { parents.push(parent); } 750 } else { 751 parents.push(parent); 752 } 753 parent = parent.parentNode; 754 } 755 } 756 return $(unique(parents)); 757 } 758 function closest(selector) { 759 var closest = this; // eslint-disable-line 760 if (typeof selector === 'undefined') { 761 return new Dom7([]); 762 } 763 if (!closest.is(selector)) { 764 closest = closest.parents(selector).eq(0); 765 } 766 return closest; 767 } 768 function find(selector) { 769 var foundElements = []; 770 for (var i = 0; i < this.length; i += 1) { 771 var found = this[i].querySelectorAll(selector); 772 for (var j = 0; j < found.length; j += 1) { 773 foundElements.push(found[j]); 774 } 775 } 776 return new Dom7(foundElements); 777 } 778 function children(selector) { 779 var children = []; // eslint-disable-line 780 for (var i = 0; i < this.length; i += 1) { 781 var childNodes = this[i].childNodes; 782 783 for (var j = 0; j < childNodes.length; j += 1) { 784 if (!selector) { 785 if (childNodes[j].nodeType === 1) { children.push(childNodes[j]); } 786 } else if (childNodes[j].nodeType === 1 && $(childNodes[j]).is(selector)) { 787 children.push(childNodes[j]); 788 } 789 } 790 } 791 return new Dom7(unique(children)); 792 } 793 function remove() { 794 for (var i = 0; i < this.length; i += 1) { 795 if (this[i].parentNode) { this[i].parentNode.removeChild(this[i]); } 796 } 797 return this; 798 } 799 function add() { 800 var args = [], len = arguments.length; 801 while ( len-- ) args[ len ] = arguments[ len ]; 802 803 var dom = this; 804 var i; 805 var j; 806 for (i = 0; i < args.length; i += 1) { 807 var toAdd = $(args[i]); 808 for (j = 0; j < toAdd.length; j += 1) { 809 dom[dom.length] = toAdd[j]; 810 dom.length += 1; 811 } 812 } 813 return dom; 814 } 815 816 var Methods = { 817 addClass: addClass, 818 removeClass: removeClass, 819 hasClass: hasClass, 820 toggleClass: toggleClass, 821 attr: attr, 822 removeAttr: removeAttr, 823 data: data, 824 transform: transform, 825 transition: transition, 826 on: on, 827 off: off, 828 trigger: trigger, 829 transitionEnd: transitionEnd, 830 outerWidth: outerWidth, 831 outerHeight: outerHeight, 832 offset: offset, 833 css: css, 834 each: each, 835 html: html, 836 text: text, 837 is: is, 838 index: index, 839 eq: eq, 840 append: append, 841 prepend: prepend, 842 next: next, 843 nextAll: nextAll, 844 prev: prev, 845 prevAll: prevAll, 846 parent: parent, 847 parents: parents, 848 closest: closest, 849 find: find, 850 children: children, 851 filter: filter, 852 remove: remove, 853 add: add, 854 styles: styles, 855 }; 856 857 Object.keys(Methods).forEach(function (methodName) { 858 $.fn[methodName] = $.fn[methodName] || Methods[methodName]; 859 }); 860 861 var Utils = { 862 deleteProps: function deleteProps(obj) { 863 var object = obj; 864 Object.keys(object).forEach(function (key) { 865 try { 866 object[key] = null; 867 } catch (e) { 868 // no getter for object 869 } 870 try { 871 delete object[key]; 872 } catch (e) { 873 // something got wrong 874 } 875 }); 876 }, 877 nextTick: function nextTick(callback, delay) { 878 if ( delay === void 0 ) delay = 0; 879 880 return setTimeout(callback, delay); 881 }, 882 now: function now() { 883 return Date.now(); 884 }, 885 getTranslate: function getTranslate(el, axis) { 886 if ( axis === void 0 ) axis = 'x'; 887 888 var matrix; 889 var curTransform; 890 var transformMatrix; 891 892 var curStyle = win.getComputedStyle(el, null); 893 894 if (win.WebKitCSSMatrix) { 895 curTransform = curStyle.transform || curStyle.webkitTransform; 896 if (curTransform.split(',').length > 6) { 897 curTransform = curTransform.split(', ').map(function (a) { return a.replace(',', '.'); }).join(', '); 898 } 899 // Some old versions of Webkit choke when 'none' is passed; pass 900 // empty string instead in this case 901 transformMatrix = new win.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform); 902 } else { 903 transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,'); 904 matrix = transformMatrix.toString().split(','); 905 } 906 907 if (axis === 'x') { 908 // Latest Chrome and webkits Fix 909 if (win.WebKitCSSMatrix) { curTransform = transformMatrix.m41; } 910 // Crazy IE10 Matrix 911 else if (matrix.length === 16) { curTransform = parseFloat(matrix[12]); } 912 // Normal Browsers 913 else { curTransform = parseFloat(matrix[4]); } 914 } 915 if (axis === 'y') { 916 // Latest Chrome and webkits Fix 917 if (win.WebKitCSSMatrix) { curTransform = transformMatrix.m42; } 918 // Crazy IE10 Matrix 919 else if (matrix.length === 16) { curTransform = parseFloat(matrix[13]); } 920 // Normal Browsers 921 else { curTransform = parseFloat(matrix[5]); } 922 } 923 return curTransform || 0; 924 }, 925 parseUrlQuery: function parseUrlQuery(url) { 926 var query = {}; 927 var urlToParse = url || win.location.href; 928 var i; 929 var params; 930 var param; 931 var length; 932 if (typeof urlToParse === 'string' && urlToParse.length) { 933 urlToParse = urlToParse.indexOf('?') > -1 ? urlToParse.replace(/\S*\?/, '') : ''; 934 params = urlToParse.split('&').filter(function (paramsPart) { return paramsPart !== ''; }); 935 length = params.length; 936 937 for (i = 0; i < length; i += 1) { 938 param = params[i].replace(/#\S+/g, '').split('='); 939 query[decodeURIComponent(param[0])] = typeof param[1] === 'undefined' ? undefined : decodeURIComponent(param[1]) || ''; 940 } 941 } 942 return query; 943 }, 944 isObject: function isObject(o) { 945 return typeof o === 'object' && o !== null && o.constructor && o.constructor === Object; 946 }, 947 extend: function extend() { 948 var args = [], len$1 = arguments.length; 949 while ( len$1-- ) args[ len$1 ] = arguments[ len$1 ]; 950 951 var to = Object(args[0]); 952 for (var i = 1; i < args.length; i += 1) { 953 var nextSource = args[i]; 954 if (nextSource !== undefined && nextSource !== null) { 955 var keysArray = Object.keys(Object(nextSource)); 956 for (var nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1) { 957 var nextKey = keysArray[nextIndex]; 958 var desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); 959 if (desc !== undefined && desc.enumerable) { 960 if (Utils.isObject(to[nextKey]) && Utils.isObject(nextSource[nextKey])) { 961 Utils.extend(to[nextKey], nextSource[nextKey]); 962 } else if (!Utils.isObject(to[nextKey]) && Utils.isObject(nextSource[nextKey])) { 963 to[nextKey] = {}; 964 Utils.extend(to[nextKey], nextSource[nextKey]); 965 } else { 966 to[nextKey] = nextSource[nextKey]; 967 } 968 } 969 } 970 } 971 } 972 return to; 973 }, 974 }; 975 976 var Support = (function Support() { 977 return { 978 touch: (win.Modernizr && win.Modernizr.touch === true) || (function checkTouch() { 979 return !!((win.navigator.maxTouchPoints > 0) || ('ontouchstart' in win) || (win.DocumentTouch && doc instanceof win.DocumentTouch)); 980 }()), 981 982 pointerEvents: !!win.PointerEvent && ('maxTouchPoints' in win.navigator) && win.navigator.maxTouchPoints > 0, 983 984 observer: (function checkObserver() { 985 return ('MutationObserver' in win || 'WebkitMutationObserver' in win); 986 }()), 987 988 passiveListener: (function checkPassiveListener() { 989 var supportsPassive = false; 990 try { 991 var opts = Object.defineProperty({}, 'passive', { 992 // eslint-disable-next-line 993 get: function get() { 994 supportsPassive = true; 995 }, 996 }); 997 win.addEventListener('testPassiveListener', null, opts); 998 } catch (e) { 999 // No support 1000 } 1001 return supportsPassive; 1002 }()), 1003 1004 gestures: (function checkGestures() { 1005 return 'ongesturestart' in win; 1006 }()), 1007 }; 1008 }()); 1009 1010 var SwiperClass = function SwiperClass(params) { 1011 if ( params === void 0 ) params = {}; 1012 1013 var self = this; 1014 self.params = params; 1015 1016 // Events 1017 self.eventsListeners = {}; 1018 1019 if (self.params && self.params.on) { 1020 Object.keys(self.params.on).forEach(function (eventName) { 1021 self.on(eventName, self.params.on[eventName]); 1022 }); 1023 } 1024 }; 1025 1026 var staticAccessors = { components: { configurable: true } }; 1027 1028 SwiperClass.prototype.on = function on (events, handler, priority) { 1029 var self = this; 1030 if (typeof handler !== 'function') { return self; } 1031 var method = priority ? 'unshift' : 'push'; 1032 events.split(' ').forEach(function (event) { 1033 if (!self.eventsListeners[event]) { self.eventsListeners[event] = []; } 1034 self.eventsListeners[event][method](handler); 1035 }); 1036 return self; 1037 }; 1038 1039 SwiperClass.prototype.once = function once (events, handler, priority) { 1040 var self = this; 1041 if (typeof handler !== 'function') { return self; } 1042 function onceHandler() { 1043 var args = [], len = arguments.length; 1044 while ( len-- ) args[ len ] = arguments[ len ]; 1045 1046 self.off(events, onceHandler); 1047 if (onceHandler.f7proxy) { 1048 delete onceHandler.f7proxy; 1049 } 1050 handler.apply(self, args); 1051 } 1052 onceHandler.f7proxy = handler; 1053 return self.on(events, onceHandler, priority); 1054 }; 1055 1056 SwiperClass.prototype.off = function off (events, handler) { 1057 var self = this; 1058 if (!self.eventsListeners) { return self; } 1059 events.split(' ').forEach(function (event) { 1060 if (typeof handler === 'undefined') { 1061 self.eventsListeners[event] = []; 1062 } else if (self.eventsListeners[event] && self.eventsListeners[event].length) { 1063 self.eventsListeners[event].forEach(function (eventHandler, index) { 1064 if (eventHandler === handler || (eventHandler.f7proxy && eventHandler.f7proxy === handler)) { 1065 self.eventsListeners[event].splice(index, 1); 1066 } 1067 }); 1068 } 1069 }); 1070 return self; 1071 }; 1072 1073 SwiperClass.prototype.emit = function emit () { 1074 var args = [], len = arguments.length; 1075 while ( len-- ) args[ len ] = arguments[ len ]; 1076 1077 var self = this; 1078 if (!self.eventsListeners) { return self; } 1079 var events; 1080 var data; 1081 var context; 1082 if (typeof args[0] === 'string' || Array.isArray(args[0])) { 1083 events = args[0]; 1084 data = args.slice(1, args.length); 1085 context = self; 1086 } else { 1087 events = args[0].events; 1088 data = args[0].data; 1089 context = args[0].context || self; 1090 } 1091 var eventsArray = Array.isArray(events) ? events : events.split(' '); 1092 eventsArray.forEach(function (event) { 1093 if (self.eventsListeners && self.eventsListeners[event]) { 1094 var handlers = []; 1095 self.eventsListeners[event].forEach(function (eventHandler) { 1096 handlers.push(eventHandler); 1097 }); 1098 handlers.forEach(function (eventHandler) { 1099 eventHandler.apply(context, data); 1100 }); 1101 } 1102 }); 1103 return self; 1104 }; 1105 1106 SwiperClass.prototype.useModulesParams = function useModulesParams (instanceParams) { 1107 var instance = this; 1108 if (!instance.modules) { return; } 1109 Object.keys(instance.modules).forEach(function (moduleName) { 1110 var module = instance.modules[moduleName]; 1111 // Extend params 1112 if (module.params) { 1113 Utils.extend(instanceParams, module.params); 1114 } 1115 }); 1116 }; 1117 1118 SwiperClass.prototype.useModules = function useModules (modulesParams) { 1119 if ( modulesParams === void 0 ) modulesParams = {}; 1120 1121 var instance = this; 1122 if (!instance.modules) { return; } 1123 Object.keys(instance.modules).forEach(function (moduleName) { 1124 var module = instance.modules[moduleName]; 1125 var moduleParams = modulesParams[moduleName] || {}; 1126 // Extend instance methods and props 1127 if (module.instance) { 1128 Object.keys(module.instance).forEach(function (modulePropName) { 1129 var moduleProp = module.instance[modulePropName]; 1130 if (typeof moduleProp === 'function') { 1131 instance[modulePropName] = moduleProp.bind(instance); 1132 } else { 1133 instance[modulePropName] = moduleProp; 1134 } 1135 }); 1136 } 1137 // Add event listeners 1138 if (module.on && instance.on) { 1139 Object.keys(module.on).forEach(function (moduleEventName) { 1140 instance.on(moduleEventName, module.on[moduleEventName]); 1141 }); 1142 } 1143 1144 // Module create callback 1145 if (module.create) { 1146 module.create.bind(instance)(moduleParams); 1147 } 1148 }); 1149 }; 1150 1151 staticAccessors.components.set = function (components) { 1152 var Class = this; 1153 if (!Class.use) { return; } 1154 Class.use(components); 1155 }; 1156 1157 SwiperClass.installModule = function installModule (module) { 1158 var params = [], len = arguments.length - 1; 1159 while ( len-- > 0 ) params[ len ] = arguments[ len + 1 ]; 1160 1161 var Class = this; 1162 if (!Class.prototype.modules) { Class.prototype.modules = {}; } 1163 var name = module.name || (((Object.keys(Class.prototype.modules).length) + "_" + (Utils.now()))); 1164 Class.prototype.modules[name] = module; 1165 // Prototype 1166 if (module.proto) { 1167 Object.keys(module.proto).forEach(function (key) { 1168 Class.prototype[key] = module.proto[key]; 1169 }); 1170 } 1171 // Class 1172 if (module.static) { 1173 Object.keys(module.static).forEach(function (key) { 1174 Class[key] = module.static[key]; 1175 }); 1176 } 1177 // Callback 1178 if (module.install) { 1179 module.install.apply(Class, params); 1180 } 1181 return Class; 1182 }; 1183 1184 SwiperClass.use = function use (module) { 1185 var params = [], len = arguments.length - 1; 1186 while ( len-- > 0 ) params[ len ] = arguments[ len + 1 ]; 1187 1188 var Class = this; 1189 if (Array.isArray(module)) { 1190 module.forEach(function (m) { return Class.installModule(m); }); 1191 return Class; 1192 } 1193 return Class.installModule.apply(Class, [ module ].concat( params )); 1194 }; 1195 1196 Object.defineProperties( SwiperClass, staticAccessors ); 1197 1198 function updateSize () { 1199 var swiper = this; 1200 var width; 1201 var height; 1202 var $el = swiper.$el; 1203 if (typeof swiper.params.width !== 'undefined') { 1204 width = swiper.params.width; 1205 } else { 1206 width = $el[0].clientWidth; 1207 } 1208 if (typeof swiper.params.height !== 'undefined') { 1209 height = swiper.params.height; 1210 } else { 1211 height = $el[0].clientHeight; 1212 } 1213 if ((width === 0 && swiper.isHorizontal()) || (height === 0 && swiper.isVertical())) { 1214 return; 1215 } 1216 1217 // Subtract paddings 1218 width = width - parseInt($el.css('padding-left'), 10) - parseInt($el.css('padding-right'), 10); 1219 height = height - parseInt($el.css('padding-top'), 10) - parseInt($el.css('padding-bottom'), 10); 1220 1221 Utils.extend(swiper, { 1222 width: width, 1223 height: height, 1224 size: swiper.isHorizontal() ? width : height, 1225 }); 1226 } 1227 1228 function updateSlides () { 1229 var swiper = this; 1230 var params = swiper.params; 1231 1232 var $wrapperEl = swiper.$wrapperEl; 1233 var swiperSize = swiper.size; 1234 var rtl = swiper.rtlTranslate; 1235 var wrongRTL = swiper.wrongRTL; 1236 var isVirtual = swiper.virtual && params.virtual.enabled; 1237 var previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length; 1238 var slides = $wrapperEl.children(("." + (swiper.params.slideClass))); 1239 var slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length; 1240 var snapGrid = []; 1241 var slidesGrid = []; 1242 var slidesSizesGrid = []; 1243 1244 function slidesForMargin(slideIndex) { 1245 if (!params.cssMode) { return true; } 1246 if (slideIndex === slides.length - 1) { 1247 return false; 1248 } 1249 return true; 1250 } 1251 1252 var offsetBefore = params.slidesOffsetBefore; 1253 if (typeof offsetBefore === 'function') { 1254 offsetBefore = params.slidesOffsetBefore.call(swiper); 1255 } 1256 1257 var offsetAfter = params.slidesOffsetAfter; 1258 if (typeof offsetAfter === 'function') { 1259 offsetAfter = params.slidesOffsetAfter.call(swiper); 1260 } 1261 1262 var previousSnapGridLength = swiper.snapGrid.length; 1263 var previousSlidesGridLength = swiper.snapGrid.length; 1264 1265 var spaceBetween = params.spaceBetween; 1266 var slidePosition = -offsetBefore; 1267 var prevSlideSize = 0; 1268 var index = 0; 1269 if (typeof swiperSize === 'undefined') { 1270 return; 1271 } 1272 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) { 1273 spaceBetween = (parseFloat(spaceBetween.replace('%', '')) / 100) * swiperSize; 1274 } 1275 1276 swiper.virtualSize = -spaceBetween; 1277 1278 // reset margins 1279 if (rtl) { slides.css({ marginLeft: '', marginTop: '' }); } 1280 else { slides.css({ marginRight: '', marginBottom: '' }); } 1281 1282 var slidesNumberEvenToRows; 1283 if (params.slidesPerColumn > 1) { 1284 if (Math.floor(slidesLength / params.slidesPerColumn) === slidesLength / swiper.params.slidesPerColumn) { 1285 slidesNumberEvenToRows = slidesLength; 1286 } else { 1287 slidesNumberEvenToRows = Math.ceil(slidesLength / params.slidesPerColumn) * params.slidesPerColumn; 1288 } 1289 if (params.slidesPerView !== 'auto' && params.slidesPerColumnFill === 'row') { 1290 slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, params.slidesPerView * params.slidesPerColumn); 1291 } 1292 } 1293 1294 // Calc slides 1295 var slideSize; 1296 var slidesPerColumn = params.slidesPerColumn; 1297 var slidesPerRow = slidesNumberEvenToRows / slidesPerColumn; 1298 var numFullColumns = Math.floor(slidesLength / params.slidesPerColumn); 1299 for (var i = 0; i < slidesLength; i += 1) { 1300 slideSize = 0; 1301 var slide = slides.eq(i); 1302 if (params.slidesPerColumn > 1) { 1303 // Set slides order 1304 var newSlideOrderIndex = (void 0); 1305 var column = (void 0); 1306 var row = (void 0); 1307 if (params.slidesPerColumnFill === 'row' && params.slidesPerGroup > 1) { 1308 var groupIndex = Math.floor(i / (params.slidesPerGroup * params.slidesPerColumn)); 1309 var slideIndexInGroup = i - params.slidesPerColumn * params.slidesPerGroup * groupIndex; 1310 var columnsInGroup = groupIndex === 0 1311 ? params.slidesPerGroup 1312 : Math.min(Math.ceil((slidesLength - groupIndex * slidesPerColumn * params.slidesPerGroup) / slidesPerColumn), params.slidesPerGroup); 1313 row = Math.floor(slideIndexInGroup / columnsInGroup); 1314 column = (slideIndexInGroup - row * columnsInGroup) + groupIndex * params.slidesPerGroup; 1315 1316 newSlideOrderIndex = column + ((row * slidesNumberEvenToRows) / slidesPerColumn); 1317 slide 1318 .css({ 1319 '-webkit-box-ordinal-group': newSlideOrderIndex, 1320 '-moz-box-ordinal-group': newSlideOrderIndex, 1321 '-ms-flex-order': newSlideOrderIndex, 1322 '-webkit-order': newSlideOrderIndex, 1323 order: newSlideOrderIndex, 1324 }); 1325 } else if (params.slidesPerColumnFill === 'column') { 1326 column = Math.floor(i / slidesPerColumn); 1327 row = i - (column * slidesPerColumn); 1328 if (column > numFullColumns || (column === numFullColumns && row === slidesPerColumn - 1)) { 1329 row += 1; 1330 if (row >= slidesPerColumn) { 1331 row = 0; 1332 column += 1; 1333 } 1334 } 1335 } else { 1336 row = Math.floor(i / slidesPerRow); 1337 column = i - (row * slidesPerRow); 1338 } 1339 slide.css( 1340 ("margin-" + (swiper.isHorizontal() ? 'top' : 'left')), 1341 (row !== 0 && params.spaceBetween) && (((params.spaceBetween) + "px")) 1342 ); 1343 } 1344 if (slide.css('display') === 'none') { continue; } // eslint-disable-line 1345 1346 if (params.slidesPerView === 'auto') { 1347 var slideStyles = win.getComputedStyle(slide[0], null); 1348 var currentTransform = slide[0].style.transform; 1349 var currentWebKitTransform = slide[0].style.webkitTransform; 1350 if (currentTransform) { 1351 slide[0].style.transform = 'none'; 1352 } 1353 if (currentWebKitTransform) { 1354 slide[0].style.webkitTransform = 'none'; 1355 } 1356 if (params.roundLengths) { 1357 slideSize = swiper.isHorizontal() 1358 ? slide.outerWidth(true) 1359 : slide.outerHeight(true); 1360 } else { 1361 // eslint-disable-next-line 1362 if (swiper.isHorizontal()) { 1363 var width = parseFloat(slideStyles.getPropertyValue('width')); 1364 var paddingLeft = parseFloat(slideStyles.getPropertyValue('padding-left')); 1365 var paddingRight = parseFloat(slideStyles.getPropertyValue('padding-right')); 1366 var marginLeft = parseFloat(slideStyles.getPropertyValue('margin-left')); 1367 var marginRight = parseFloat(slideStyles.getPropertyValue('margin-right')); 1368 var boxSizing = slideStyles.getPropertyValue('box-sizing'); 1369 if (boxSizing && boxSizing === 'border-box') { 1370 slideSize = width + marginLeft + marginRight; 1371 } else { 1372 slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight; 1373 } 1374 } else { 1375 var height = parseFloat(slideStyles.getPropertyValue('height')); 1376 var paddingTop = parseFloat(slideStyles.getPropertyValue('padding-top')); 1377 var paddingBottom = parseFloat(slideStyles.getPropertyValue('padding-bottom')); 1378 var marginTop = parseFloat(slideStyles.getPropertyValue('margin-top')); 1379 var marginBottom = parseFloat(slideStyles.getPropertyValue('margin-bottom')); 1380 var boxSizing$1 = slideStyles.getPropertyValue('box-sizing'); 1381 if (boxSizing$1 && boxSizing$1 === 'border-box') { 1382 slideSize = height + marginTop + marginBottom; 1383 } else { 1384 slideSize = height + paddingTop + paddingBottom + marginTop + marginBottom; 1385 } 1386 } 1387 } 1388 if (currentTransform) { 1389 slide[0].style.transform = currentTransform; 1390 } 1391 if (currentWebKitTransform) { 1392 slide[0].style.webkitTransform = currentWebKitTransform; 1393 } 1394 if (params.roundLengths) { slideSize = Math.floor(slideSize); } 1395 } else { 1396 slideSize = (swiperSize - ((params.slidesPerView - 1) * spaceBetween)) / params.slidesPerView; 1397 if (params.roundLengths) { slideSize = Math.floor(slideSize); } 1398 1399 if (slides[i]) { 1400 if (swiper.isHorizontal()) { 1401 slides[i].style.width = slideSize + "px"; 1402 } else { 1403 slides[i].style.height = slideSize + "px"; 1404 } 1405 } 1406 } 1407 if (slides[i]) { 1408 slides[i].swiperSlideSize = slideSize; 1409 } 1410 slidesSizesGrid.push(slideSize); 1411 1412 1413 if (params.centeredSlides) { 1414 slidePosition = slidePosition + (slideSize / 2) + (prevSlideSize / 2) + spaceBetween; 1415 if (prevSlideSize === 0 && i !== 0) { slidePosition = slidePosition - (swiperSize / 2) - spaceBetween; } 1416 if (i === 0) { slidePosition = slidePosition - (swiperSize / 2) - spaceBetween; } 1417 if (Math.abs(slidePosition) < 1 / 1000) { slidePosition = 0; } 1418 if (params.roundLengths) { slidePosition = Math.floor(slidePosition); } 1419 if ((index) % params.slidesPerGroup === 0) { snapGrid.push(slidePosition); } 1420 slidesGrid.push(slidePosition); 1421 } else { 1422 if (params.roundLengths) { slidePosition = Math.floor(slidePosition); } 1423 if ((index) % params.slidesPerGroup === 0) { snapGrid.push(slidePosition); } 1424 slidesGrid.push(slidePosition); 1425 slidePosition = slidePosition + slideSize + spaceBetween; 1426 } 1427 1428 swiper.virtualSize += slideSize + spaceBetween; 1429 1430 prevSlideSize = slideSize; 1431 1432 index += 1; 1433 } 1434 swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter; 1435 var newSlidesGrid; 1436 1437 if ( 1438 rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) { 1439 $wrapperEl.css({ width: ((swiper.virtualSize + params.spaceBetween) + "px") }); 1440 } 1441 if (params.setWrapperSize) { 1442 if (swiper.isHorizontal()) { $wrapperEl.css({ width: ((swiper.virtualSize + params.spaceBetween) + "px") }); } 1443 else { $wrapperEl.css({ height: ((swiper.virtualSize + params.spaceBetween) + "px") }); } 1444 } 1445 1446 if (params.slidesPerColumn > 1) { 1447 swiper.virtualSize = (slideSize + params.spaceBetween) * slidesNumberEvenToRows; 1448 swiper.virtualSize = Math.ceil(swiper.virtualSize / params.slidesPerColumn) - params.spaceBetween; 1449 if (swiper.isHorizontal()) { $wrapperEl.css({ width: ((swiper.virtualSize + params.spaceBetween) + "px") }); } 1450 else { $wrapperEl.css({ height: ((swiper.virtualSize + params.spaceBetween) + "px") }); } 1451 if (params.centeredSlides) { 1452 newSlidesGrid = []; 1453 for (var i$1 = 0; i$1 < snapGrid.length; i$1 += 1) { 1454 var slidesGridItem = snapGrid[i$1]; 1455 if (params.roundLengths) { slidesGridItem = Math.floor(slidesGridItem); } 1456 if (snapGrid[i$1] < swiper.virtualSize + snapGrid[0]) { newSlidesGrid.push(slidesGridItem); } 1457 } 1458 snapGrid = newSlidesGrid; 1459 } 1460 } 1461 1462 // Remove last grid elements depending on width 1463 if (!params.centeredSlides) { 1464 newSlidesGrid = []; 1465 for (var i$2 = 0; i$2 < snapGrid.length; i$2 += 1) { 1466 var slidesGridItem$1 = snapGrid[i$2]; 1467 if (params.roundLengths) { slidesGridItem$1 = Math.floor(slidesGridItem$1); } 1468 if (snapGrid[i$2] <= swiper.virtualSize - swiperSize) { 1469 newSlidesGrid.push(slidesGridItem$1); 1470 } 1471 } 1472 snapGrid = newSlidesGrid; 1473 if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) { 1474 snapGrid.push(swiper.virtualSize - swiperSize); 1475 } 1476 } 1477 if (snapGrid.length === 0) { snapGrid = [0]; } 1478 1479 if (params.spaceBetween !== 0) { 1480 if (swiper.isHorizontal()) { 1481 if (rtl) { slides.filter(slidesForMargin).css({ marginLeft: (spaceBetween + "px") }); } 1482 else { slides.filter(slidesForMargin).css({ marginRight: (spaceBetween + "px") }); } 1483 } else { slides.filter(slidesForMargin).css({ marginBottom: (spaceBetween + "px") }); } 1484 } 1485 1486 if (params.centeredSlides && params.centeredSlidesBounds) { 1487 var allSlidesSize = 0; 1488 slidesSizesGrid.forEach(function (slideSizeValue) { 1489 allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0); 1490 }); 1491 allSlidesSize -= params.spaceBetween; 1492 var maxSnap = allSlidesSize - swiperSize; 1493 snapGrid = snapGrid.map(function (snap) { 1494 if (snap < 0) { return -offsetBefore; } 1495 if (snap > maxSnap) { return maxSnap + offsetAfter; } 1496 return snap; 1497 }); 1498 } 1499 1500 if (params.centerInsufficientSlides) { 1501 var allSlidesSize$1 = 0; 1502 slidesSizesGrid.forEach(function (slideSizeValue) { 1503 allSlidesSize$1 += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0); 1504 }); 1505 allSlidesSize$1 -= params.spaceBetween; 1506 if (allSlidesSize$1 < swiperSize) { 1507 var allSlidesOffset = (swiperSize - allSlidesSize$1) / 2; 1508 snapGrid.forEach(function (snap, snapIndex) { 1509 snapGrid[snapIndex] = snap - allSlidesOffset; 1510 }); 1511 slidesGrid.forEach(function (snap, snapIndex) { 1512 slidesGrid[snapIndex] = snap + allSlidesOffset; 1513 }); 1514 } 1515 } 1516 1517 Utils.extend(swiper, { 1518 slides: slides, 1519 snapGrid: snapGrid, 1520 slidesGrid: slidesGrid, 1521 slidesSizesGrid: slidesSizesGrid, 1522 }); 1523 1524 if (slidesLength !== previousSlidesLength) { 1525 swiper.emit('slidesLengthChange'); 1526 } 1527 if (snapGrid.length !== previousSnapGridLength) { 1528 if (swiper.params.watchOverflow) { swiper.checkOverflow(); } 1529 swiper.emit('snapGridLengthChange'); 1530 } 1531 if (slidesGrid.length !== previousSlidesGridLength) { 1532 swiper.emit('slidesGridLengthChange'); 1533 } 1534 1535 if (params.watchSlidesProgress || params.watchSlidesVisibility) { 1536 swiper.updateSlidesOffset(); 1537 } 1538 } 1539 1540 function updateAutoHeight (speed) { 1541 var swiper = this; 1542 var activeSlides = []; 1543 var newHeight = 0; 1544 var i; 1545 if (typeof speed === 'number') { 1546 swiper.setTransition(speed); 1547 } else if (speed === true) { 1548 swiper.setTransition(swiper.params.speed); 1549 } 1550 // Find slides currently in view 1551 if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) { 1552 for (i = 0; i < Math.ceil(swiper.params.slidesPerView); i += 1) { 1553 var index = swiper.activeIndex + i; 1554 if (index > swiper.slides.length) { break; } 1555 activeSlides.push(swiper.slides.eq(index)[0]); 1556 } 1557 } else { 1558 activeSlides.push(swiper.slides.eq(swiper.activeIndex)[0]); 1559 } 1560 1561 // Find new height from highest slide in view 1562 for (i = 0; i < activeSlides.length; i += 1) { 1563 if (typeof activeSlides[i] !== 'undefined') { 1564 var height = activeSlides[i].offsetHeight; 1565 newHeight = height > newHeight ? height : newHeight; 1566 } 1567 } 1568 1569 // Update Height 1570 if (newHeight) { swiper.$wrapperEl.css('height', (newHeight + "px")); } 1571 } 1572 1573 function updateSlidesOffset () { 1574 var swiper = this; 1575 var slides = swiper.slides; 1576 for (var i = 0; i < slides.length; i += 1) { 1577 slides[i].swiperSlideOffset = swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop; 1578 } 1579 } 1580 1581 function updateSlidesProgress (translate) { 1582 if ( translate === void 0 ) translate = (this && this.translate) || 0; 1583 1584 var swiper = this; 1585 var params = swiper.params; 1586 1587 var slides = swiper.slides; 1588 var rtl = swiper.rtlTranslate; 1589 1590 if (slides.length === 0) { return; } 1591 if (typeof slides[0].swiperSlideOffset === 'undefined') { swiper.updateSlidesOffset(); } 1592 1593 var offsetCenter = -translate; 1594 if (rtl) { offsetCenter = translate; } 1595 1596 // Visible Slides 1597 slides.removeClass(params.slideVisibleClass); 1598 1599 swiper.visibleSlidesIndexes = []; 1600 swiper.visibleSlides = []; 1601 1602 for (var i = 0; i < slides.length; i += 1) { 1603 var slide = slides[i]; 1604 var slideProgress = ( 1605 (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0)) - slide.swiperSlideOffset 1606 ) / (slide.swiperSlideSize + params.spaceBetween); 1607 if (params.watchSlidesVisibility) { 1608 var slideBefore = -(offsetCenter - slide.swiperSlideOffset); 1609 var slideAfter = slideBefore + swiper.slidesSizesGrid[i]; 1610 var isVisible = (slideBefore >= 0 && slideBefore < swiper.size - 1) 1611 || (slideAfter > 1 && slideAfter <= swiper.size) 1612 || (slideBefore <= 0 && slideAfter >= swiper.size); 1613 if (isVisible) { 1614 swiper.visibleSlides.push(slide); 1615 swiper.visibleSlidesIndexes.push(i); 1616 slides.eq(i).addClass(params.slideVisibleClass); 1617 } 1618 } 1619 slide.progress = rtl ? -slideProgress : slideProgress; 1620 } 1621 swiper.visibleSlides = $(swiper.visibleSlides); 1622 } 1623 1624 function updateProgress (translate) { 1625 var swiper = this; 1626 if (typeof translate === 'undefined') { 1627 var multiplier = swiper.rtlTranslate ? -1 : 1; 1628 // eslint-disable-next-line 1629 translate = (swiper && swiper.translate && (swiper.translate * multiplier)) || 0; 1630 } 1631 var params = swiper.params;
vendor: 8,024 bytes, lines 1631-1850
1631 1632 var translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 1633 var progress = swiper.progress; 1634 var isBeginning = swiper.isBeginning; 1635 var isEnd = swiper.isEnd; 1636 var wasBeginning = isBeginning; 1637 var wasEnd = isEnd; 1638 if (translatesDiff === 0) { 1639 progress = 0; 1640 isBeginning = true; 1641 isEnd = true; 1642 } else { 1643 progress = (translate - swiper.minTranslate()) / (translatesDiff); 1644 isBeginning = progress <= 0; 1645 isEnd = progress >= 1; 1646 } 1647 Utils.extend(swiper, { 1648 progress: progress, 1649 isBeginning: isBeginning, 1650 isEnd: isEnd, 1651 }); 1652 1653 if (params.watchSlidesProgress || params.watchSlidesVisibility) { swiper.updateSlidesProgress(translate); } 1654 1655 if (isBeginning && !wasBeginning) { 1656 swiper.emit('reachBeginning toEdge'); 1657 } 1658 if (isEnd && !wasEnd) { 1659 swiper.emit('reachEnd toEdge'); 1660 } 1661 if ((wasBeginning && !isBeginning) || (wasEnd && !isEnd)) { 1662 swiper.emit('fromEdge'); 1663 } 1664 1665 swiper.emit('progress', progress); 1666 } 1667 1668 function updateSlidesClasses () { 1669 var swiper = this; 1670 1671 var slides = swiper.slides; 1672 var params = swiper.params; 1673 var $wrapperEl = swiper.$wrapperEl; 1674 var activeIndex = swiper.activeIndex; 1675 var realIndex = swiper.realIndex; 1676 var isVirtual = swiper.virtual && params.virtual.enabled; 1677 1678 slides.removeClass(((params.slideActiveClass) + " " + (params.slideNextClass) + " " + (params.slidePrevClass) + " " + (params.slideDuplicateActiveClass) + " " + (params.slideDuplicateNextClass) + " " + (params.slideDuplicatePrevClass))); 1679 1680 var activeSlide; 1681 if (isVirtual) { 1682 activeSlide = swiper.$wrapperEl.find(("." + (params.slideClass) + "[data-swiper-slide-index=\"" + activeIndex + "\"]")); 1683 } else { 1684 activeSlide = slides.eq(activeIndex); 1685 } 1686 1687 // Active classes 1688 activeSlide.addClass(params.slideActiveClass); 1689 1690 if (params.loop) { 1691 // Duplicate to all looped slides 1692 if (activeSlide.hasClass(params.slideDuplicateClass)) { 1693 $wrapperEl 1694 .children(("." + (params.slideClass) + ":not(." + (params.slideDuplicateClass) + ")[data-swiper-slide-index=\"" + realIndex + "\"]")) 1695 .addClass(params.slideDuplicateActiveClass); 1696 } else { 1697 $wrapperEl 1698 .children(("." + (params.slideClass) + "." + (params.slideDuplicateClass) + "[data-swiper-slide-index=\"" + realIndex + "\"]")) 1699 .addClass(params.slideDuplicateActiveClass); 1700 } 1701 } 1702 // Next Slide 1703 var nextSlide = activeSlide.nextAll(("." + (params.slideClass))).eq(0).addClass(params.slideNextClass); 1704 if (params.loop && nextSlide.length === 0) { 1705 nextSlide = slides.eq(0); 1706 nextSlide.addClass(params.slideNextClass); 1707 } 1708 // Prev Slide 1709 var prevSlide = activeSlide.prevAll(("." + (params.slideClass))).eq(0).addClass(params.slidePrevClass); 1710 if (params.loop && prevSlide.length === 0) { 1711 prevSlide = slides.eq(-1); 1712 prevSlide.addClass(params.slidePrevClass); 1713 } 1714 if (params.loop) { 1715 // Duplicate to all looped slides 1716 if (nextSlide.hasClass(params.slideDuplicateClass)) { 1717 $wrapperEl 1718 .children(("." + (params.slideClass) + ":not(." + (params.slideDuplicateClass) + ")[data-swiper-slide-index=\"" + (nextSlide.attr('data-swiper-slide-index')) + "\"]")) 1719 .addClass(params.slideDuplicateNextClass); 1720 } else { 1721 $wrapperEl 1722 .children(("." + (params.slideClass) + "." + (params.slideDuplicateClass) + "[data-swiper-slide-index=\"" + (nextSlide.attr('data-swiper-slide-index')) + "\"]")) 1723 .addClass(params.slideDuplicateNextClass); 1724 } 1725 if (prevSlide.hasClass(params.slideDuplicateClass)) { 1726 $wrapperEl 1727 .children(("." + (params.slideClass) + ":not(." + (params.slideDuplicateClass) + ")[data-swiper-slide-index=\"" + (prevSlide.attr('data-swiper-slide-index')) + "\"]")) 1728 .addClass(params.slideDuplicatePrevClass); 1729 } else { 1730 $wrapperEl 1731 .children(("." + (params.slideClass) + "." + (params.slideDuplicateClass) + "[data-swiper-slide-index=\"" + (prevSlide.attr('data-swiper-slide-index')) + "\"]")) 1732 .addClass(params.slideDuplicatePrevClass); 1733 } 1734 } 1735 } 1736 1737 function updateActiveIndex (newActiveIndex) { 1738 var swiper = this; 1739 var translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 1740 var slidesGrid = swiper.slidesGrid; 1741 var snapGrid = swiper.snapGrid; 1742 var params = swiper.params; 1743 var previousIndex = swiper.activeIndex; 1744 var previousRealIndex = swiper.realIndex; 1745 var previousSnapIndex = swiper.snapIndex; 1746 var activeIndex = newActiveIndex; 1747 var snapIndex; 1748 if (typeof activeIndex === 'undefined') { 1749 for (var i = 0; i < slidesGrid.length; i += 1) { 1750 if (typeof slidesGrid[i + 1] !== 'undefined') { 1751 if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - ((slidesGrid[i + 1] - slidesGrid[i]) / 2)) { 1752 activeIndex = i; 1753 } else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) { 1754 activeIndex = i + 1; 1755 } 1756 } else if (translate >= slidesGrid[i]) { 1757 activeIndex = i; 1758 } 1759 } 1760 // Normalize slideIndex 1761 if (params.normalizeSlideIndex) { 1762 if (activeIndex < 0 || typeof activeIndex === 'undefined') { activeIndex = 0; } 1763 } 1764 } 1765 if (snapGrid.indexOf(translate) >= 0) { 1766 snapIndex = snapGrid.indexOf(translate); 1767 } else { 1768 snapIndex = Math.floor(activeIndex / params.slidesPerGroup); 1769 } 1770 if (snapIndex >= snapGrid.length) { snapIndex = snapGrid.length - 1; } 1771 if (activeIndex === previousIndex) { 1772 if (snapIndex !== previousSnapIndex) { 1773 swiper.snapIndex = snapIndex; 1774 swiper.emit('snapIndexChange'); 1775 } 1776 return; 1777 } 1778 1779 // Get real index 1780 var realIndex = parseInt(swiper.slides.eq(activeIndex).attr('data-swiper-slide-index') || activeIndex, 10); 1781 1782 Utils.extend(swiper, { 1783 snapIndex: snapIndex, 1784 realIndex: realIndex, 1785 previousIndex: previousIndex, 1786 activeIndex: activeIndex, 1787 }); 1788 swiper.emit('activeIndexChange'); 1789 swiper.emit('snapIndexChange'); 1790 if (previousRealIndex !== realIndex) { 1791 swiper.emit('realIndexChange'); 1792 } 1793 if (swiper.initialized || swiper.runCallbacksOnInit) { 1794 swiper.emit('slideChange'); 1795 } 1796 } 1797 1798 function updateClickedSlide (e) { 1799 var swiper = this; 1800 var params = swiper.params; 1801 var slide = $(e.target).closest(("." + (params.slideClass)))[0]; 1802 var slideFound = false; 1803 if (slide) { 1804 for (var i = 0; i < swiper.slides.length; i += 1) { 1805 if (swiper.slides[i] === slide) { slideFound = true; } 1806 } 1807 } 1808 1809 if (slide && slideFound) { 1810 swiper.clickedSlide = slide; 1811 if (swiper.virtual && swiper.params.virtual.enabled) { 1812 swiper.clickedIndex = parseInt($(slide).attr('data-swiper-slide-index'), 10); 1813 } else { 1814 swiper.clickedIndex = $(slide).index(); 1815 } 1816 } else { 1817 swiper.clickedSlide = undefined; 1818 swiper.clickedIndex = undefined; 1819 return; 1820 } 1821 if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) { 1822 swiper.slideToClickedSlide(); 1823 } 1824 } 1825 1826 var update = { 1827 updateSize: updateSize, 1828 updateSlides: updateSlides, 1829 updateAutoHeight: updateAutoHeight, 1830 updateSlidesOffset: updateSlidesOffset, 1831 updateSlidesProgress: updateSlidesProgress, 1832 updateProgress: updateProgress, 1833 updateSlidesClasses: updateSlidesClasses, 1834 updateActiveIndex: updateActiveIndex, 1835 updateClickedSlide: updateClickedSlide, 1836 }; 1837 1838 function getTranslate (axis) { 1839 if ( axis === void 0 ) axis = this.isHorizontal() ? 'x' : 'y'; 1840 1841 var swiper = this; 1842 1843 var params = swiper.params; 1844 var rtl = swiper.rtlTranslate; 1845 var translate = swiper.translate; 1846 var $wrapperEl = swiper.$wrapperEl; 1847 1848 if (params.virtualTranslate) { 1849 return rtl ? -translate : translate; 1850 }
vendor: 2,187 bytes, lines 1851-1927
1851 if (params.cssMode) { 1852 return translate; 1853 } 1854 1855 var currentTranslate = Utils.getTranslate($wrapperEl[0], axis); 1856 if (rtl) { currentTranslate = -currentTranslate; } 1857 1858 return currentTranslate || 0; 1859 } 1860 1861 function setTranslate (translate, byController) { 1862 var swiper = this; 1863 var rtl = swiper.rtlTranslate; 1864 var params = swiper.params; 1865 var $wrapperEl = swiper.$wrapperEl; 1866 var wrapperEl = swiper.wrapperEl; 1867 var progress = swiper.progress; 1868 var x = 0; 1869 var y = 0; 1870 var z = 0; 1871 1872 if (swiper.isHorizontal()) { 1873 x = rtl ? -translate : translate; 1874 } else { 1875 y = translate; 1876 } 1877 1878 if (params.roundLengths) { 1879 x = Math.floor(x); 1880 y = Math.floor(y); 1881 } 1882 1883 if (params.cssMode) { 1884 wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y; 1885 } else if (!params.virtualTranslate) { 1886 $wrapperEl.transform(("translate3d(" + x + "px, " + y + "px, " + z + "px)")); 1887 } 1888 swiper.previousTranslate = swiper.translate; 1889 swiper.translate = swiper.isHorizontal() ? x : y; 1890 1891 // Check if we need to update progress 1892 var newProgress; 1893 var translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 1894 if (translatesDiff === 0) { 1895 newProgress = 0; 1896 } else { 1897 newProgress = (translate - swiper.minTranslate()) / (translatesDiff); 1898 } 1899 if (newProgress !== progress) { 1900 swiper.updateProgress(translate); 1901 } 1902 1903 swiper.emit('setTranslate', swiper.translate, byController); 1904 } 1905 1906 function minTranslate () { 1907 return (-this.snapGrid[0]); 1908 } 1909 1910 function maxTranslate () { 1911 return (-this.snapGrid[this.snapGrid.length - 1]); 1912 } 1913 1914 function translateTo (translate, speed, runCallbacks, translateBounds, internal) { 1915 var obj; 1916 1917 if ( translate === void 0 ) translate = 0; 1918 if ( speed === void 0 ) speed = this.params.speed; 1919 if ( runCallbacks === void 0 ) runCallbacks = true; 1920 if ( translateBounds === void 0 ) translateBounds = true; 1921 var swiper = this; 1922 1923 var params = swiper.params; 1924 var wrapperEl = swiper.wrapperEl; 1925 1926 if (swiper.animating && params.preventInteractionOnTransition) { 1927 return false;
1928 } 1929 1930 var minTranslate = swiper.minTranslate(); 1931 var maxTranslate = swiper.maxTranslate(); 1932 var newTranslate; 1933 if (translateBounds && translate > minTranslate) { newTranslate = minTranslate; } 1934 else if (translateBounds && translate < maxTranslate) { newTranslate = maxTranslate; } 1935 else { newTranslate = translate; } 1936 1937 // Update progress 1938 swiper.updateProgress(newTranslate); 1939 1940 if (params.cssMode) { 1941 var isH = swiper.isHorizontal(); 1942 if (speed === 0) { 1943 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate; 1944 } else { 1945 // eslint-disable-next-line 1946 if (wrapperEl.scrollTo) { 1947 wrapperEl.scrollTo(( obj = {}, obj[isH ? 'left' : 'top'] = -newTranslate, obj.behavior = 'smooth', obj )); 1948 } else { 1949 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate; 1950 } 1951 } 1952 return true; 1953 } 1954 1955 if (speed === 0) { 1956 swiper.setTransition(0); 1957 swiper.setTranslate(newTranslate); 1958 if (runCallbacks) { 1959 swiper.emit('beforeTransitionStart', speed, internal); 1960 swiper.emit('transitionEnd'); 1961 } 1962 } else { 1963 swiper.setTransition(speed); 1964 swiper.setTranslate(newTranslate); 1965 if (runCallbacks) { 1966 swiper.emit('beforeTransitionStart', speed, internal); 1967 swiper.emit('transitionStart'); 1968 } 1969 if (!swiper.animating) { 1970 swiper.animating = true; 1971 if (!swiper.onTranslateToWrapperTransitionEnd) { 1972 swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) { 1973 if (!swiper || swiper.destroyed) { return; } 1974 if (e.target !== this) { return; } 1975 swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); 1976 swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd); 1977 swiper.onTranslateToWrapperTransitionEnd = null; 1978 delete swiper.onTranslateToWrapperTransitionEnd; 1979 if (runCallbacks) { 1980 swiper.emit('transitionEnd'); 1981 } 1982 }; 1983 } 1984 swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); 1985 swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd); 1986 } 1987 } 1988 1989 return true; 1990 } 1991 1992 var translate = { 1993 getTranslate: getTranslate, 1994 setTranslate: setTranslate, 1995 minTranslate: minTranslate, 1996 maxTranslate: maxTranslate, 1997 translateTo: translateTo, 1998 }; 1999 2000 function setTransition (duration, byController) { 2001 var swiper = this; 2002 2003 if (!swiper.params.cssMode) { 2004 swiper.$wrapperEl.transition(duration); 2005 } 2006 2007 swiper.emit('setTransition', duration, byController); 2008 } 2009 2010 function transitionStart (runCallbacks, direction) { 2011 if ( runCallbacks === void 0 ) runCallbacks = true; 2012 2013 var swiper = this; 2014 var activeIndex = swiper.activeIndex; 2015 var params = swiper.params; 2016 var previousIndex = swiper.previousIndex; 2017 if (params.cssMode) { return; } 2018 if (params.autoHeight) { 2019 swiper.updateAutoHeight(); 2020 } 2021 2022 var dir = direction; 2023 if (!dir) { 2024 if (activeIndex > previousIndex) { dir = 'next'; } 2025 else if (activeIndex < previousIndex) { dir = 'prev'; } 2026 else { dir = 'reset'; } 2027 } 2028 2029 swiper.emit('transitionStart'); 2030 2031 if (runCallbacks && activeIndex !== previousIndex) { 2032 if (dir === 'reset') { 2033 swiper.emit('slideResetTransitionStart'); 2034 return; 2035 } 2036 swiper.emit('slideChangeTransitionStart'); 2037 if (dir === 'next') { 2038 swiper.emit('slideNextTransitionStart'); 2039 } else { 2040 swiper.emit('slidePrevTransitionStart'); 2041 } 2042 } 2043 } 2044 2045 function transitionEnd$1 (runCallbacks, direction) { 2046 if ( runCallbacks === void 0 ) runCallbacks = true; 2047 2048 var swiper = this; 2049 var activeIndex = swiper.activeIndex; 2050 var previousIndex = swiper.previousIndex; 2051 var params = swiper.params; 2052 swiper.animating = false; 2053 if (params.cssMode) { return; } 2054 swiper.setTransition(0); 2055 2056 var dir = direction; 2057 if (!dir) { 2058 if (activeIndex > previousIndex) { dir = 'next'; } 2059 else if (activeIndex < previousIndex) { dir = 'prev'; } 2060 else { dir = 'reset'; } 2061 } 2062 2063 swiper.emit('transitionEnd'); 2064 2065 if (runCallbacks && activeIndex !== previousIndex) { 2066 if (dir === 'reset') { 2067 swiper.emit('slideResetTransitionEnd'); 2068 return; 2069 } 2070 swiper.emit('slideChangeTransitionEnd'); 2071 if (dir === 'next') { 2072 swiper.emit('slideNextTransitionEnd'); 2073 } else { 2074 swiper.emit('slidePrevTransitionEnd'); 2075 } 2076 } 2077 } 2078 2079 var transition$1 = { 2080 setTransition: setTransition, 2081 transitionStart: transitionStart, 2082 transitionEnd: transitionEnd$1, 2083 }; 2084 2085 function slideTo (index, speed, runCallbacks, internal) { 2086 var obj; 2087 2088 if ( index === void 0 ) index = 0; 2089 if ( speed === void 0 ) speed = this.params.speed; 2090 if ( runCallbacks === void 0 ) runCallbacks = true; 2091 var swiper = this; 2092 var slideIndex = index; 2093 if (slideIndex < 0) { slideIndex = 0; } 2094 2095 var params = swiper.params; 2096 var snapGrid = swiper.snapGrid; 2097 var slidesGrid = swiper.slidesGrid; 2098 var previousIndex = swiper.previousIndex; 2099 var activeIndex = swiper.activeIndex; 2100 var rtl = swiper.rtlTranslate; 2101 var wrapperEl = swiper.wrapperEl; 2102 if (swiper.animating && params.preventInteractionOnTransition) { 2103 return false;
vendor: 5,576 bytes, lines 2104-2259
2104 } 2105 2106 var snapIndex = Math.floor(slideIndex / params.slidesPerGroup); 2107 if (snapIndex >= snapGrid.length) { snapIndex = snapGrid.length - 1; } 2108 2109 if ((activeIndex || params.initialSlide || 0) === (previousIndex || 0) && runCallbacks) { 2110 swiper.emit('beforeSlideChangeStart'); 2111 } 2112 2113 var translate = -snapGrid[snapIndex]; 2114 2115 // Update progress 2116 swiper.updateProgress(translate); 2117 2118 // Normalize slideIndex 2119 if (params.normalizeSlideIndex) { 2120 for (var i = 0; i < slidesGrid.length; i += 1) { 2121 if (-Math.floor(translate * 100) >= Math.floor(slidesGrid[i] * 100)) { 2122 slideIndex = i; 2123 } 2124 } 2125 } 2126 // Directions locks 2127 if (swiper.initialized && slideIndex !== activeIndex) { 2128 if (!swiper.allowSlideNext && translate < swiper.translate && translate < swiper.minTranslate()) { 2129 return false; 2130 } 2131 if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) { 2132 if ((activeIndex || 0) !== slideIndex) { return false; } 2133 } 2134 } 2135 2136 var direction; 2137 if (slideIndex > activeIndex) { direction = 'next'; } 2138 else if (slideIndex < activeIndex) { direction = 'prev'; } 2139 else { direction = 'reset'; } 2140 2141 2142 // Update Index 2143 if ((rtl && -translate === swiper.translate) || (!rtl && translate === swiper.translate)) { 2144 swiper.updateActiveIndex(slideIndex); 2145 // Update Height 2146 if (params.autoHeight) { 2147 swiper.updateAutoHeight(); 2148 } 2149 swiper.updateSlidesClasses(); 2150 if (params.effect !== 'slide') { 2151 swiper.setTranslate(translate); 2152 } 2153 if (direction !== 'reset') { 2154 swiper.transitionStart(runCallbacks, direction); 2155 swiper.transitionEnd(runCallbacks, direction); 2156 } 2157 return false; 2158 } 2159 if (params.cssMode) { 2160 var isH = swiper.isHorizontal(); 2161 if (speed === 0) { 2162 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -translate; 2163 } else { 2164 // eslint-disable-next-line 2165 if (wrapperEl.scrollTo) { 2166 wrapperEl.scrollTo(( obj = {}, obj[isH ? 'left' : 'top'] = -translate, obj.behavior = 'smooth', obj )); 2167 } else { 2168 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -translate; 2169 } 2170 } 2171 return true; 2172 } 2173 2174 if (speed === 0) { 2175 swiper.setTransition(0); 2176 swiper.setTranslate(translate); 2177 swiper.updateActiveIndex(slideIndex); 2178 swiper.updateSlidesClasses(); 2179 swiper.emit('beforeTransitionStart', speed, internal); 2180 swiper.transitionStart(runCallbacks, direction); 2181 swiper.transitionEnd(runCallbacks, direction); 2182 } else { 2183 swiper.setTransition(speed); 2184 swiper.setTranslate(translate); 2185 swiper.updateActiveIndex(slideIndex); 2186 swiper.updateSlidesClasses(); 2187 swiper.emit('beforeTransitionStart', speed, internal); 2188 swiper.transitionStart(runCallbacks, direction); 2189 if (!swiper.animating) { 2190 swiper.animating = true; 2191 if (!swiper.onSlideToWrapperTransitionEnd) { 2192 swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) { 2193 if (!swiper || swiper.destroyed) { return; } 2194 if (e.target !== this) { return; } 2195 swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); 2196 swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd); 2197 swiper.onSlideToWrapperTransitionEnd = null; 2198 delete swiper.onSlideToWrapperTransitionEnd; 2199 swiper.transitionEnd(runCallbacks, direction); 2200 }; 2201 } 2202 swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); 2203 swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd); 2204 } 2205 } 2206 2207 return true; 2208 } 2209 2210 function slideToLoop (index, speed, runCallbacks, internal) { 2211 if ( index === void 0 ) index = 0; 2212 if ( speed === void 0 ) speed = this.params.speed; 2213 if ( runCallbacks === void 0 ) runCallbacks = true; 2214 2215 var swiper = this; 2216 var newIndex = index; 2217 if (swiper.params.loop) { 2218 newIndex += swiper.loopedSlides; 2219 } 2220 2221 return swiper.slideTo(newIndex, speed, runCallbacks, internal); 2222 } 2223 2224 /* eslint no-unused-vars: "off" */ 2225 function slideNext (speed, runCallbacks, internal) { 2226 if ( speed === void 0 ) speed = this.params.speed; 2227 if ( runCallbacks === void 0 ) runCallbacks = true; 2228 2229 var swiper = this; 2230 var params = swiper.params; 2231 var animating = swiper.animating; 2232 if (params.loop) { 2233 if (animating) { return false; } 2234 swiper.loopFix(); 2235 // eslint-disable-next-line 2236 swiper._clientLeft = swiper.$wrapperEl[0].clientLeft; 2237 return swiper.slideTo(swiper.activeIndex + params.slidesPerGroup, speed, runCallbacks, internal); 2238 } 2239 return swiper.slideTo(swiper.activeIndex + params.slidesPerGroup, speed, runCallbacks, internal); 2240 } 2241 2242 /* eslint no-unused-vars: "off" */ 2243 function slidePrev (speed, runCallbacks, internal) { 2244 if ( speed === void 0 ) speed = this.params.speed; 2245 if ( runCallbacks === void 0 ) runCallbacks = true; 2246 2247 var swiper = this; 2248 var params = swiper.params; 2249 var animating = swiper.animating; 2250 var snapGrid = swiper.snapGrid; 2251 var slidesGrid = swiper.slidesGrid; 2252 var rtlTranslate = swiper.rtlTranslate; 2253 2254 if (params.loop) { 2255 if (animating) { return false; } 2256 swiper.loopFix(); 2257 // eslint-disable-next-line 2258 swiper._clientLeft = swiper.$wrapperEl[0].clientLeft; 2259 }
2260 var translate = rtlTranslate ? swiper.translate : -swiper.translate; 2261 function normalize(val) { 2262 if (val < 0) { return -Math.floor(Math.abs(val)); } 2263 return Math.floor(val); 2264 } 2265 var normalizedTranslate = normalize(translate); 2266 var normalizedSnapGrid = snapGrid.map(function (val) { return normalize(val); }); 2267 var normalizedSlidesGrid = slidesGrid.map(function (val) { return normalize(val); }); 2268 2269 var currentSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate)]; 2270 var prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1]; 2271 if (typeof prevSnap === 'undefined' && params.cssMode) { 2272 snapGrid.forEach(function (snap) { 2273 if (!prevSnap && normalizedTranslate >= snap) { prevSnap = snap; } 2274 }); 2275 } 2276 var prevIndex; 2277 if (typeof prevSnap !== 'undefined') { 2278 prevIndex = slidesGrid.indexOf(prevSnap); 2279 if (prevIndex < 0) { prevIndex = swiper.activeIndex - 1; } 2280 } 2281 return swiper.slideTo(prevIndex, speed, runCallbacks, internal); 2282 } 2283 2284 /* eslint no-unused-vars: "off" */ 2285 function slideReset (speed, runCallbacks, internal) { 2286 if ( speed === void 0 ) speed = this.params.speed; 2287 if ( runCallbacks === void 0 ) runCallbacks = true; 2288 2289 var swiper = this; 2290 return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal); 2291 } 2292 2293 /* eslint no-unused-vars: "off" */ 2294 function slideToClosest (speed, runCallbacks, internal, threshold) { 2295 if ( speed === void 0 ) speed = this.params.speed; 2296 if ( runCallbacks === void 0 ) runCallbacks = true; 2297 if ( threshold === void 0 ) threshold = 0.5; 2298 2299 var swiper = this; 2300 var index = swiper.activeIndex; 2301 var snapIndex = Math.floor(index / swiper.params.slidesPerGroup); 2302 2303 var translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 2304 2305 if (translate >= swiper.snapGrid[snapIndex]) { 2306 // The current translate is on or after the current snap index, so the choice 2307 // is between the current index and the one after it. 2308 var currentSnap = swiper.snapGrid[snapIndex]; 2309 var nextSnap = swiper.snapGrid[snapIndex + 1]; 2310 if ((translate - currentSnap) > (nextSnap - currentSnap) * threshold) { 2311 index += swiper.params.slidesPerGroup; 2312 } 2313 } else { 2314 // The current translate is before the current snap index, so the choice 2315 // is between the current index and the one before it. 2316 var prevSnap = swiper.snapGrid[snapIndex - 1]; 2317 var currentSnap$1 = swiper.snapGrid[snapIndex]; 2318 if ((translate - prevSnap) <= (currentSnap$1 - prevSnap) * threshold) { 2319 index -= swiper.params.slidesPerGroup; 2320 } 2321 } 2322 index = Math.max(index, 0); 2323 index = Math.min(index, swiper.snapGrid.length - 1); 2324 2325 return swiper.slideTo(index, speed, runCallbacks, internal); 2326 } 2327 2328 function slideToClickedSlide () { 2329 var swiper = this; 2330 var params = swiper.params; 2331 var $wrapperEl = swiper.$wrapperEl; 2332 2333 var slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView; 2334 var slideToIndex = swiper.clickedIndex; 2335 var realIndex; 2336 if (params.loop) { 2337 if (swiper.animating) { return; } 2338 realIndex = parseInt($(swiper.clickedSlide).attr('data-swiper-slide-index'), 10); 2339 if (params.centeredSlides) { 2340 if ( 2341 (slideToIndex < swiper.loopedSlides - (slidesPerView / 2)) 2342 || (slideToIndex > (swiper.slides.length - swiper.loopedSlides) + (slidesPerView / 2)) 2343 ) { 2344 swiper.loopFix(); 2345 slideToIndex = $wrapperEl 2346 .children(("." + (params.slideClass) + "[data-swiper-slide-index=\"" + realIndex + "\"]:not(." + (params.slideDuplicateClass) + ")")) 2347 .eq(0) 2348 .index(); 2349 2350 Utils.nextTick(function () { 2351 swiper.slideTo(slideToIndex); 2352 }); 2353 } else { 2354 swiper.slideTo(slideToIndex); 2355 } 2356 } else if (slideToIndex > swiper.slides.length - slidesPerView) { 2357 swiper.loopFix(); 2358 slideToIndex = $wrapperEl 2359 .children(("." + (params.slideClass) + "[data-swiper-slide-index=\"" + realIndex + "\"]:not(." + (params.slideDuplicateClass) + ")")) 2360 .eq(0) 2361 .index(); 2362 2363 Utils.nextTick(function () { 2364 swiper.slideTo(slideToIndex); 2365 }); 2366 } else { 2367 swiper.slideTo(slideToIndex); 2368 } 2369 } else { 2370 swiper.slideTo(slideToIndex); 2371 } 2372 } 2373 2374 var slide = { 2375 slideTo: slideTo, 2376 slideToLoop: slideToLoop, 2377 slideNext: slideNext, 2378 slidePrev: slidePrev, 2379 slideReset: slideReset, 2380 slideToClosest: slideToClosest, 2381 slideToClickedSlide: slideToClickedSlide, 2382 }; 2383 2384 function loopCreate () { 2385 var swiper = this; 2386 var params = swiper.params; 2387 var $wrapperEl = swiper.$wrapperEl; 2388 // Remove duplicated slides 2389 $wrapperEl.children(("." + (params.slideClass) + "." + (params.slideDuplicateClass))).remove(); 2390 2391 var slides = $wrapperEl.children(("." + (params.slideClass))); 2392 2393 if (params.loopFillGroupWithBlank) {
vendor: 9,440 bytes, lines 2394-2689
2394 var blankSlidesNum = params.slidesPerGroup - (slides.length % params.slidesPerGroup); 2395 if (blankSlidesNum !== params.slidesPerGroup) { 2396 for (var i = 0; i < blankSlidesNum; i += 1) { 2397 var blankNode = $(doc.createElement('div')).addClass(((params.slideClass) + " " + (params.slideBlankClass))); 2398 $wrapperEl.append(blankNode); 2399 } 2400 slides = $wrapperEl.children(("." + (params.slideClass))); 2401 } 2402 } 2403 2404 if (params.slidesPerView === 'auto' && !params.loopedSlides) { params.loopedSlides = slides.length; } 2405 2406 swiper.loopedSlides = Math.ceil(parseFloat(params.loopedSlides || params.slidesPerView, 10)); 2407 swiper.loopedSlides += params.loopAdditionalSlides; 2408 if (swiper.loopedSlides > slides.length) { 2409 swiper.loopedSlides = slides.length; 2410 } 2411 2412 var prependSlides = []; 2413 var appendSlides = []; 2414 slides.each(function (index, el) { 2415 var slide = $(el); 2416 if (index < swiper.loopedSlides) { appendSlides.push(el); } 2417 if (index < slides.length && index >= slides.length - swiper.loopedSlides) { prependSlides.push(el); } 2418 slide.attr('data-swiper-slide-index', index); 2419 }); 2420 for (var i$1 = 0; i$1 < appendSlides.length; i$1 += 1) { 2421 $wrapperEl.append($(appendSlides[i$1].cloneNode(true)).addClass(params.slideDuplicateClass)); 2422 } 2423 for (var i$2 = prependSlides.length - 1; i$2 >= 0; i$2 -= 1) { 2424 $wrapperEl.prepend($(prependSlides[i$2].cloneNode(true)).addClass(params.slideDuplicateClass)); 2425 } 2426 } 2427 2428 function loopFix () { 2429 var swiper = this; 2430 2431 swiper.emit('beforeLoopFix'); 2432 2433 var activeIndex = swiper.activeIndex; 2434 var slides = swiper.slides; 2435 var loopedSlides = swiper.loopedSlides; 2436 var allowSlidePrev = swiper.allowSlidePrev; 2437 var allowSlideNext = swiper.allowSlideNext; 2438 var snapGrid = swiper.snapGrid; 2439 var rtl = swiper.rtlTranslate; 2440 var newIndex; 2441 swiper.allowSlidePrev = true; 2442 swiper.allowSlideNext = true; 2443 2444 var snapTranslate = -snapGrid[activeIndex]; 2445 var diff = snapTranslate - swiper.getTranslate(); 2446 2447 // Fix For Negative Oversliding 2448 if (activeIndex < loopedSlides) { 2449 newIndex = (slides.length - (loopedSlides * 3)) + activeIndex; 2450 newIndex += loopedSlides; 2451 var slideChanged = swiper.slideTo(newIndex, 0, false, true); 2452 if (slideChanged && diff !== 0) { 2453 swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff); 2454 } 2455 } else if (activeIndex >= slides.length - loopedSlides) { 2456 // Fix For Positive Oversliding 2457 newIndex = -slides.length + activeIndex + loopedSlides; 2458 newIndex += loopedSlides; 2459 var slideChanged$1 = swiper.slideTo(newIndex, 0, false, true); 2460 if (slideChanged$1 && diff !== 0) { 2461 swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff); 2462 } 2463 } 2464 swiper.allowSlidePrev = allowSlidePrev; 2465 swiper.allowSlideNext = allowSlideNext; 2466 2467 swiper.emit('loopFix'); 2468 } 2469 2470 function loopDestroy () { 2471 var swiper = this; 2472 var $wrapperEl = swiper.$wrapperEl; 2473 var params = swiper.params; 2474 var slides = swiper.slides; 2475 $wrapperEl.children(("." + (params.slideClass) + "." + (params.slideDuplicateClass) + ",." + (params.slideClass) + "." + (params.slideBlankClass))).remove(); 2476 slides.removeAttr('data-swiper-slide-index'); 2477 } 2478 2479 var loop = { 2480 loopCreate: loopCreate, 2481 loopFix: loopFix, 2482 loopDestroy: loopDestroy, 2483 }; 2484 2485 function setGrabCursor (moving) { 2486 var swiper = this; 2487 if (Support.touch || !swiper.params.simulateTouch || (swiper.params.watchOverflow && swiper.isLocked) || swiper.params.cssMode) { return; } 2488 var el = swiper.el; 2489 el.style.cursor = 'move'; 2490 el.style.cursor = moving ? '-webkit-grabbing' : '-webkit-grab'; 2491 el.style.cursor = moving ? '-moz-grabbin' : '-moz-grab'; 2492 el.style.cursor = moving ? 'grabbing' : 'grab'; 2493 } 2494 2495 function unsetGrabCursor () { 2496 var swiper = this; 2497 if (Support.touch || (swiper.params.watchOverflow && swiper.isLocked) || swiper.params.cssMode) { return; } 2498 swiper.el.style.cursor = ''; 2499 } 2500 2501 var grabCursor = { 2502 setGrabCursor: setGrabCursor, 2503 unsetGrabCursor: unsetGrabCursor, 2504 }; 2505 2506 function appendSlide (slides) { 2507 var swiper = this; 2508 var $wrapperEl = swiper.$wrapperEl; 2509 var params = swiper.params; 2510 if (params.loop) { 2511 swiper.loopDestroy(); 2512 } 2513 if (typeof slides === 'object' && 'length' in slides) { 2514 for (var i = 0; i < slides.length; i += 1) { 2515 if (slides[i]) { $wrapperEl.append(slides[i]); } 2516 } 2517 } else { 2518 $wrapperEl.append(slides); 2519 } 2520 if (params.loop) { 2521 swiper.loopCreate(); 2522 } 2523 if (!(params.observer && Support.observer)) { 2524 swiper.update(); 2525 } 2526 } 2527 2528 function prependSlide (slides) { 2529 var swiper = this; 2530 var params = swiper.params; 2531 var $wrapperEl = swiper.$wrapperEl; 2532 var activeIndex = swiper.activeIndex; 2533 2534 if (params.loop) { 2535 swiper.loopDestroy(); 2536 } 2537 var newActiveIndex = activeIndex + 1; 2538 if (typeof slides === 'object' && 'length' in slides) { 2539 for (var i = 0; i < slides.length; i += 1) { 2540 if (slides[i]) { $wrapperEl.prepend(slides[i]); } 2541 } 2542 newActiveIndex = activeIndex + slides.length; 2543 } else { 2544 $wrapperEl.prepend(slides); 2545 } 2546 if (params.loop) { 2547 swiper.loopCreate(); 2548 } 2549 if (!(params.observer && Support.observer)) { 2550 swiper.update(); 2551 } 2552 swiper.slideTo(newActiveIndex, 0, false); 2553 } 2554 2555 function addSlide (index, slides) { 2556 var swiper = this; 2557 var $wrapperEl = swiper.$wrapperEl; 2558 var params = swiper.params; 2559 var activeIndex = swiper.activeIndex; 2560 var activeIndexBuffer = activeIndex; 2561 if (params.loop) { 2562 activeIndexBuffer -= swiper.loopedSlides; 2563 swiper.loopDestroy(); 2564 swiper.slides = $wrapperEl.children(("." + (params.slideClass))); 2565 } 2566 var baseLength = swiper.slides.length; 2567 if (index <= 0) { 2568 swiper.prependSlide(slides); 2569 return; 2570 } 2571 if (index >= baseLength) { 2572 swiper.appendSlide(slides); 2573 return; 2574 } 2575 var newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + 1 : activeIndexBuffer; 2576 2577 var slidesBuffer = []; 2578 for (var i = baseLength - 1; i >= index; i -= 1) { 2579 var currentSlide = swiper.slides.eq(i); 2580 currentSlide.remove(); 2581 slidesBuffer.unshift(currentSlide); 2582 } 2583 2584 if (typeof slides === 'object' && 'length' in slides) { 2585 for (var i$1 = 0; i$1 < slides.length; i$1 += 1) { 2586 if (slides[i$1]) { $wrapperEl.append(slides[i$1]); } 2587 } 2588 newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + slides.length : activeIndexBuffer; 2589 } else { 2590 $wrapperEl.append(slides); 2591 } 2592 2593 for (var i$2 = 0; i$2 < slidesBuffer.length; i$2 += 1) { 2594 $wrapperEl.append(slidesBuffer[i$2]); 2595 } 2596 2597 if (params.loop) { 2598 swiper.loopCreate(); 2599 } 2600 if (!(params.observer && Support.observer)) { 2601 swiper.update(); 2602 } 2603 if (params.loop) { 2604 swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false); 2605 } else { 2606 swiper.slideTo(newActiveIndex, 0, false); 2607 } 2608 } 2609 2610 function removeSlide (slidesIndexes) { 2611 var swiper = this; 2612 var params = swiper.params; 2613 var $wrapperEl = swiper.$wrapperEl; 2614 var activeIndex = swiper.activeIndex; 2615 2616 var activeIndexBuffer = activeIndex; 2617 if (params.loop) { 2618 activeIndexBuffer -= swiper.loopedSlides; 2619 swiper.loopDestroy(); 2620 swiper.slides = $wrapperEl.children(("." + (params.slideClass))); 2621 } 2622 var newActiveIndex = activeIndexBuffer; 2623 var indexToRemove; 2624 2625 if (typeof slidesIndexes === 'object' && 'length' in slidesIndexes) { 2626 for (var i = 0; i < slidesIndexes.length; i += 1) { 2627 indexToRemove = slidesIndexes[i]; 2628 if (swiper.slides[indexToRemove]) { swiper.slides.eq(indexToRemove).remove(); } 2629 if (indexToRemove < newActiveIndex) { newActiveIndex -= 1; } 2630 } 2631 newActiveIndex = Math.max(newActiveIndex, 0); 2632 } else { 2633 indexToRemove = slidesIndexes; 2634 if (swiper.slides[indexToRemove]) { swiper.slides.eq(indexToRemove).remove(); } 2635 if (indexToRemove < newActiveIndex) { newActiveIndex -= 1; } 2636 newActiveIndex = Math.max(newActiveIndex, 0); 2637 } 2638 2639 if (params.loop) { 2640 swiper.loopCreate(); 2641 } 2642 2643 if (!(params.observer && Support.observer)) { 2644 swiper.update(); 2645 } 2646 if (params.loop) { 2647 swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false); 2648 } else { 2649 swiper.slideTo(newActiveIndex, 0, false); 2650 } 2651 } 2652 2653 function removeAllSlides () { 2654 var swiper = this; 2655 2656 var slidesIndexes = []; 2657 for (var i = 0; i < swiper.slides.length; i += 1) { 2658 slidesIndexes.push(i); 2659 } 2660 swiper.removeSlide(slidesIndexes); 2661 } 2662 2663 var manipulation = { 2664 appendSlide: appendSlide, 2665 prependSlide: prependSlide, 2666 addSlide: addSlide, 2667 removeSlide: removeSlide, 2668 removeAllSlides: removeAllSlides, 2669 }; 2670 2671 var Device = (function Device() { 2672 var platform = win.navigator.platform; 2673 var ua = win.navigator.userAgent; 2674 2675 var device = { 2676 ios: false, 2677 android: false, 2678 androidChrome: false, 2679 desktop: false, 2680 iphone: false, 2681 ipod: false, 2682 ipad: false, 2683 edge: false, 2684 ie: false, 2685 firefox: false, 2686 macos: false, 2687 windows: false, 2688 cordova: !!(win.cordova || win.phonegap), 2689 phonegap: !!(win.cordova || win.phonegap),
2690 electron: false, 2691 }; 2692 2693 var screenWidth = win.screen.width; 2694 var screenHeight = win.screen.height; 2695 2696 var android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line 2697 var ipad = ua.match(/(iPad).*OS\s([\d_]+)/); 2698 var ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/); 2699 var iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/); 2700 var ie = ua.indexOf('MSIE ') >= 0 || ua.indexOf('Trident/') >= 0; 2701 var edge = ua.indexOf('Edge/') >= 0; 2702 var firefox = ua.indexOf('Gecko/') >= 0 && ua.indexOf('Firefox/') >= 0; 2703 var windows = platform === 'Win32'; 2704 var electron = ua.toLowerCase().indexOf('electron') >= 0; 2705 var macos = platform === 'MacIntel'; 2706 2707 // iPadOs 13 fix 2708 if (!ipad 2709 && macos 2710 && Support.touch 2711 && ( 2712 (screenWidth === 1024 && screenHeight === 1366) // Pro 12.9 2713 || (screenWidth === 834 && screenHeight === 1194) // Pro 11 2714 || (screenWidth === 834 && screenHeight === 1112) // Pro 10.5 2715 || (screenWidth === 768 && screenHeight === 1024) // other 2716 ) 2717 ) { 2718 ipad = ua.match(/(Version)\/([\d.]+)/); 2719 macos = false; 2720 } 2721 2722 device.ie = ie; 2723 device.edge = edge; 2724 device.firefox = firefox; 2725 2726 // Android 2727 if (android && !windows) { 2728 device.os = 'android'; 2729 device.osVersion = android[2]; 2730 device.android = true; 2731 device.androidChrome = ua.toLowerCase().indexOf('chrome') >= 0; 2732 } 2733 if (ipad || iphone || ipod) { 2734 device.os = 'ios'; 2735 device.ios = true; 2736 } 2737 // iOS 2738 if (iphone && !ipod) { 2739 device.osVersion = iphone[2].replace(/_/g, '.'); 2740 device.iphone = true; 2741 } 2742 if (ipad) { 2743 device.osVersion = ipad[2].replace(/_/g, '.'); 2744 device.ipad = true; 2745 } 2746 if (ipod) { 2747 device.osVersion = ipod[3] ? ipod[3].replace(/_/g, '.') : null; 2748 device.ipod = true; 2749 } 2750 // iOS 8+ changed UA 2751 if (device.ios && device.osVersion && ua.indexOf('Version/') >= 0) { 2752 if (device.osVersion.split('.')[0] === '10') { 2753 device.osVersion = ua.toLowerCase().split('version/')[1].split(' ')[0]; 2754 } 2755 } 2756 2757 // Webview 2758 device.webView = !!((iphone || ipad || ipod) && (ua.match(/.*AppleWebKit(?!.*Safari)/i) || win.navigator.standalone)) 2759 || (win.matchMedia && win.matchMedia('(display-mode: standalone)').matches); 2760 device.webview = device.webView; 2761 device.standalone = device.webView; 2762 2763 // Desktop 2764 device.desktop = !(device.ios || device.android) || electron; 2765 if (device.desktop) { 2766 device.electron = electron; 2767 device.macos = macos; 2768 device.windows = windows; 2769 if (device.macos) { 2770 device.os = 'macos'; 2771 } 2772 if (device.windows) { 2773 device.os = 'windows'; 2774 } 2775 } 2776 2777 // Pixel Ratio 2778 device.pixelRatio = win.devicePixelRatio || 1; 2779 2780 // Export object 2781 return device; 2782 }()); 2783 2784 function onTouchStart (event) { 2785 var swiper = this; 2786 var data = swiper.touchEventsData; 2787 var params = swiper.params; 2788 var touches = swiper.touches; 2789 2790 if (swiper.animating && params.preventInteractionOnTransition) { 2791 return; 2792 } 2793 var e = event; 2794 if (e.originalEvent) { e = e.originalEvent; } 2795 var $targetEl = $(e.target); 2796 2797 if (params.touchEventsTarget === 'wrapper') { 2798 if (!$targetEl.closest(swiper.wrapperEl).length) { return; } 2799 } 2800 data.isTouchEvent = e.type === 'touchstart'; 2801 if (!data.isTouchEvent && 'which' in e && e.which === 3) { return; } 2802 if (!data.isTouchEvent && 'button' in e && e.button > 0) { return; } 2803 if (data.isTouched && data.isMoved) { return; } 2804 if (params.noSwiping && $targetEl.closest(params.noSwipingSelector ? params.noSwipingSelector : ("." + (params.noSwipingClass)))[0]) { 2805 swiper.allowClick = true; 2806 return; 2807 } 2808 if (params.swipeHandler) { 2809 if (!$targetEl.closest(params.swipeHandler)[0]) { return; } 2810 } 2811 2812 touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX; 2813 touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY; 2814 var startX = touches.currentX; 2815 var startY = touches.currentY; 2816 2817 // Do NOT start if iOS edge swipe is detected. Otherwise iOS app (UIWebView) cannot swipe-to-go-back anymore 2818 2819 var edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection; 2820 var edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold; 2821 if ( 2822 edgeSwipeDetection 2823 && ((startX <= edgeSwipeThreshold) 2824 || (startX >= win.screen.width - edgeSwipeThreshold)) 2825 ) { 2826 return; 2827 } 2828 2829 Utils.extend(data, { 2830 isTouched: true, 2831 isMoved: false, 2832 allowTouchCallbacks: true, 2833 isScrolling: undefined, 2834 startMoving: undefined, 2835 }); 2836 2837 touches.startX = startX; 2838 touches.startY = startY; 2839 data.touchStartTime = Utils.now(); 2840 swiper.allowClick = true; 2841 swiper.updateSize(); 2842 swiper.swipeDirection = undefined; 2843 if (params.threshold > 0) { data.allowThresholdMove = false; } 2844 if (e.type !== 'touchstart') { 2845 var preventDefault = true; 2846 if ($targetEl.is(data.formElements)) { preventDefault = false; } 2847 if ( 2848 doc.activeElement 2849 && $(doc.activeElement).is(data.formElements) 2850 && doc.activeElement !== $targetEl[0] 2851 ) { 2852 doc.activeElement.blur(); 2853 } 2854 2855 var shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault; 2856 if (params.touchStartForcePreventDefault || shouldPreventDefault) { 2857 e.preventDefault(); 2858 } 2859 } 2860 swiper.emit('touchStart', e); 2861 } 2862 2863 function onTouchMove (event) { 2864 var swiper = this; 2865 var data = swiper.touchEventsData; 2866 var params = swiper.params; 2867 var touches = swiper.touches; 2868 var rtl = swiper.rtlTranslate; 2869 var e = event; 2870 if (e.originalEvent) { e = e.originalEvent; } 2871 if (!data.isTouched) { 2872 if (data.startMoving && data.isScrolling) { 2873 swiper.emit('touchMoveOpposite', e); 2874 } 2875 return; 2876 } 2877 if (data.isTouchEvent && e.type === 'mousemove') { return; } 2878 var targetTouch = e.type === 'touchmove' && e.targetTouches && (e.targetTouches[0] || e.changedTouches[0]); 2879 var pageX = e.type === 'touchmove' ? targetTouch.pageX : e.pageX; 2880 var pageY = e.type === 'touchmove' ? targetTouch.pageY : e.pageY; 2881 if (e.preventedByNestedSwiper) { 2882 touches.startX = pageX; 2883 touches.startY = pageY; 2884 return; 2885 } 2886 if (!swiper.allowTouchMove) { 2887 // isMoved = true; 2888 swiper.allowClick = false;
vendor: 17,093 bytes, lines 2889-3368
2889 if (data.isTouched) { 2890 Utils.extend(touches, { 2891 startX: pageX, 2892 startY: pageY, 2893 currentX: pageX, 2894 currentY: pageY, 2895 }); 2896 data.touchStartTime = Utils.now(); 2897 } 2898 return; 2899 } 2900 if (data.isTouchEvent && params.touchReleaseOnEdges && !params.loop) { 2901 if (swiper.isVertical()) { 2902 // Vertical 2903 if ( 2904 (pageY < touches.startY && swiper.translate <= swiper.maxTranslate()) 2905 || (pageY > touches.startY && swiper.translate >= swiper.minTranslate()) 2906 ) { 2907 data.isTouched = false; 2908 data.isMoved = false; 2909 return; 2910 } 2911 } else if ( 2912 (pageX < touches.startX && swiper.translate <= swiper.maxTranslate()) 2913 || (pageX > touches.startX && swiper.translate >= swiper.minTranslate()) 2914 ) { 2915 return; 2916 } 2917 } 2918 if (data.isTouchEvent && doc.activeElement) { 2919 if (e.target === doc.activeElement && $(e.target).is(data.formElements)) { 2920 data.isMoved = true; 2921 swiper.allowClick = false; 2922 return; 2923 } 2924 } 2925 if (data.allowTouchCallbacks) { 2926 swiper.emit('touchMove', e); 2927 } 2928 if (e.targetTouches && e.targetTouches.length > 1) { return; } 2929 2930 touches.currentX = pageX; 2931 touches.currentY = pageY; 2932 2933 var diffX = touches.currentX - touches.startX; 2934 var diffY = touches.currentY - touches.startY; 2935 if (swiper.params.threshold && Math.sqrt((Math.pow( diffX, 2 )) + (Math.pow( diffY, 2 ))) < swiper.params.threshold) { return; } 2936 2937 if (typeof data.isScrolling === 'undefined') { 2938 var touchAngle; 2939 if ((swiper.isHorizontal() && touches.currentY === touches.startY) || (swiper.isVertical() && touches.currentX === touches.startX)) { 2940 data.isScrolling = false; 2941 } else { 2942 // eslint-disable-next-line 2943 if ((diffX * diffX) + (diffY * diffY) >= 25) { 2944 touchAngle = (Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180) / Math.PI; 2945 data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : (90 - touchAngle > params.touchAngle); 2946 } 2947 } 2948 } 2949 if (data.isScrolling) { 2950 swiper.emit('touchMoveOpposite', e); 2951 } 2952 if (typeof data.startMoving === 'undefined') { 2953 if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) { 2954 data.startMoving = true; 2955 } 2956 } 2957 if (data.isScrolling) { 2958 data.isTouched = false; 2959 return; 2960 } 2961 if (!data.startMoving) { 2962 return; 2963 } 2964 swiper.allowClick = false; 2965 if (!params.cssMode) { 2966 e.preventDefault(); 2967 } 2968 if (params.touchMoveStopPropagation && !params.nested) { 2969 e.stopPropagation(); 2970 } 2971 2972 if (!data.isMoved) { 2973 if (params.loop) { 2974 swiper.loopFix(); 2975 } 2976 data.startTranslate = swiper.getTranslate(); 2977 swiper.setTransition(0); 2978 if (swiper.animating) { 2979 swiper.$wrapperEl.trigger('webkitTransitionEnd transitionend'); 2980 } 2981 data.allowMomentumBounce = false; 2982 // Grab Cursor 2983 if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { 2984 swiper.setGrabCursor(true); 2985 } 2986 swiper.emit('sliderFirstMove', e); 2987 } 2988 swiper.emit('sliderMove', e); 2989 data.isMoved = true; 2990 2991 var diff = swiper.isHorizontal() ? diffX : diffY; 2992 touches.diff = diff; 2993 2994 diff *= params.touchRatio; 2995 if (rtl) { diff = -diff; } 2996 2997 swiper.swipeDirection = diff > 0 ? 'prev' : 'next'; 2998 data.currentTranslate = diff + data.startTranslate; 2999 3000 var disableParentSwiper = true; 3001 var resistanceRatio = params.resistanceRatio; 3002 if (params.touchReleaseOnEdges) { 3003 resistanceRatio = 0; 3004 } 3005 if ((diff > 0 && data.currentTranslate > swiper.minTranslate())) { 3006 disableParentSwiper = false; 3007 if (params.resistance) { data.currentTranslate = (swiper.minTranslate() - 1) + (Math.pow( (-swiper.minTranslate() + data.startTranslate + diff), resistanceRatio )); } 3008 } else if (diff < 0 && data.currentTranslate < swiper.maxTranslate()) { 3009 disableParentSwiper = false; 3010 if (params.resistance) { data.currentTranslate = (swiper.maxTranslate() + 1) - (Math.pow( (swiper.maxTranslate() - data.startTranslate - diff), resistanceRatio )); } 3011 } 3012 3013 if (disableParentSwiper) { 3014 e.preventedByNestedSwiper = true; 3015 } 3016 3017 // Directions locks 3018 if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) { 3019 data.currentTranslate = data.startTranslate; 3020 } 3021 if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) { 3022 data.currentTranslate = data.startTranslate; 3023 } 3024 3025 3026 // Threshold 3027 if (params.threshold > 0) { 3028 if (Math.abs(diff) > params.threshold || data.allowThresholdMove) { 3029 if (!data.allowThresholdMove) { 3030 data.allowThresholdMove = true; 3031 touches.startX = touches.currentX; 3032 touches.startY = touches.currentY; 3033 data.currentTranslate = data.startTranslate; 3034 touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY; 3035 return; 3036 } 3037 } else { 3038 data.currentTranslate = data.startTranslate; 3039 return; 3040 } 3041 } 3042 3043 if (!params.followFinger || params.cssMode) { return; } 3044 3045 // Update active index in free mode 3046 if (params.freeMode || params.watchSlidesProgress || params.watchSlidesVisibility) { 3047 swiper.updateActiveIndex(); 3048 swiper.updateSlidesClasses(); 3049 } 3050 if (params.freeMode) { 3051 // Velocity 3052 if (data.velocities.length === 0) { 3053 data.velocities.push({ 3054 position: touches[swiper.isHorizontal() ? 'startX' : 'startY'], 3055 time: data.touchStartTime, 3056 }); 3057 } 3058 data.velocities.push({ 3059 position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'], 3060 time: Utils.now(), 3061 }); 3062 } 3063 // Update progress 3064 swiper.updateProgress(data.currentTranslate); 3065 // Update translate 3066 swiper.setTranslate(data.currentTranslate); 3067 } 3068 3069 function onTouchEnd (event) { 3070 var swiper = this; 3071 var data = swiper.touchEventsData; 3072 3073 var params = swiper.params; 3074 var touches = swiper.touches; 3075 var rtl = swiper.rtlTranslate; 3076 var $wrapperEl = swiper.$wrapperEl; 3077 var slidesGrid = swiper.slidesGrid; 3078 var snapGrid = swiper.snapGrid; 3079 var e = event; 3080 if (e.originalEvent) { e = e.originalEvent; } 3081 if (data.allowTouchCallbacks) { 3082 swiper.emit('touchEnd', e); 3083 } 3084 data.allowTouchCallbacks = false; 3085 if (!data.isTouched) { 3086 if (data.isMoved && params.grabCursor) { 3087 swiper.setGrabCursor(false); 3088 } 3089 data.isMoved = false; 3090 data.startMoving = false; 3091 return; 3092 } 3093 // Return Grab Cursor 3094 if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) { 3095 swiper.setGrabCursor(false); 3096 } 3097 3098 // Time diff 3099 var touchEndTime = Utils.now(); 3100 var timeDiff = touchEndTime - data.touchStartTime; 3101 3102 // Tap, doubleTap, Click 3103 if (swiper.allowClick) { 3104 swiper.updateClickedSlide(e); 3105 swiper.emit('tap click', e); 3106 if (timeDiff < 300 && (touchEndTime - data.lastClickTime) < 300) { 3107 swiper.emit('doubleTap doubleClick', e); 3108 } 3109 } 3110 3111 data.lastClickTime = Utils.now(); 3112 Utils.nextTick(function () { 3113 if (!swiper.destroyed) { swiper.allowClick = true; } 3114 }); 3115 3116 if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) { 3117 data.isTouched = false; 3118 data.isMoved = false; 3119 data.startMoving = false; 3120 return; 3121 } 3122 data.isTouched = false; 3123 data.isMoved = false; 3124 data.startMoving = false; 3125 3126 var currentPos; 3127 if (params.followFinger) { 3128 currentPos = rtl ? swiper.translate : -swiper.translate; 3129 } else { 3130 currentPos = -data.currentTranslate; 3131 } 3132 3133 if (params.cssMode) { 3134 return; 3135 } 3136 3137 if (params.freeMode) { 3138 if (currentPos < -swiper.minTranslate()) { 3139 swiper.slideTo(swiper.activeIndex); 3140 return; 3141 } 3142 if (currentPos > -swiper.maxTranslate()) { 3143 if (swiper.slides.length < snapGrid.length) { 3144 swiper.slideTo(snapGrid.length - 1); 3145 } else { 3146 swiper.slideTo(swiper.slides.length - 1); 3147 } 3148 return; 3149 } 3150 3151 if (params.freeModeMomentum) { 3152 if (data.velocities.length > 1) { 3153 var lastMoveEvent = data.velocities.pop(); 3154 var velocityEvent = data.velocities.pop(); 3155 3156 var distance = lastMoveEvent.position - velocityEvent.position; 3157 var time = lastMoveEvent.time - velocityEvent.time; 3158 swiper.velocity = distance / time; 3159 swiper.velocity /= 2; 3160 if (Math.abs(swiper.velocity) < params.freeModeMinimumVelocity) { 3161 swiper.velocity = 0; 3162 } 3163 // this implies that the user stopped moving a finger then released. 3164 // There would be no events with distance zero, so the last event is stale. 3165 if (time > 150 || (Utils.now() - lastMoveEvent.time) > 300) { 3166 swiper.velocity = 0; 3167 } 3168 } else { 3169 swiper.velocity = 0; 3170 } 3171 swiper.velocity *= params.freeModeMomentumVelocityRatio; 3172 3173 data.velocities.length = 0; 3174 var momentumDuration = 1000 * params.freeModeMomentumRatio; 3175 var momentumDistance = swiper.velocity * momentumDuration; 3176 3177 var newPosition = swiper.translate + momentumDistance; 3178 if (rtl) { newPosition = -newPosition; } 3179 3180 var doBounce = false; 3181 var afterBouncePosition; 3182 var bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeModeMomentumBounceRatio; 3183 var needsLoopFix; 3184 if (newPosition < swiper.maxTranslate()) { 3185 if (params.freeModeMomentumBounce) { 3186 if (newPosition + swiper.maxTranslate() < -bounceAmount) { 3187 newPosition = swiper.maxTranslate() - bounceAmount; 3188 } 3189 afterBouncePosition = swiper.maxTranslate(); 3190 doBounce = true; 3191 data.allowMomentumBounce = true; 3192 } else { 3193 newPosition = swiper.maxTranslate(); 3194 } 3195 if (params.loop && params.centeredSlides) { needsLoopFix = true; } 3196 } else if (newPosition > swiper.minTranslate()) { 3197 if (params.freeModeMomentumBounce) { 3198 if (newPosition - swiper.minTranslate() > bounceAmount) { 3199 newPosition = swiper.minTranslate() + bounceAmount; 3200 } 3201 afterBouncePosition = swiper.minTranslate(); 3202 doBounce = true; 3203 data.allowMomentumBounce = true; 3204 } else { 3205 newPosition = swiper.minTranslate(); 3206 } 3207 if (params.loop && params.centeredSlides) { needsLoopFix = true; } 3208 } else if (params.freeModeSticky) { 3209 var nextSlide; 3210 for (var j = 0; j < snapGrid.length; j += 1) { 3211 if (snapGrid[j] > -newPosition) { 3212 nextSlide = j; 3213 break; 3214 } 3215 } 3216 3217 if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') { 3218 newPosition = snapGrid[nextSlide]; 3219 } else { 3220 newPosition = snapGrid[nextSlide - 1]; 3221 } 3222 newPosition = -newPosition; 3223 } 3224 if (needsLoopFix) { 3225 swiper.once('transitionEnd', function () { 3226 swiper.loopFix(); 3227 }); 3228 } 3229 // Fix duration 3230 if (swiper.velocity !== 0) { 3231 if (rtl) { 3232 momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity); 3233 } else { 3234 momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity); 3235 } 3236 if (params.freeModeSticky) { 3237 // If freeModeSticky is active and the user ends a swipe with a slow-velocity 3238 // event, then durations can be 20+ seconds to slide one (or zero!) slides. 3239 // It's easy to see this when simulating touch with mouse events. To fix this, 3240 // limit single-slide swipes to the default slide duration. This also has the 3241 // nice side effect of matching slide speed if the user stopped moving before 3242 // lifting finger or mouse vs. moving slowly before lifting the finger/mouse. 3243 // For faster swipes, also apply limits (albeit higher ones). 3244 var moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate); 3245 var currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex]; 3246 if (moveDistance < currentSlideSize) { 3247 momentumDuration = params.speed; 3248 } else if (moveDistance < 2 * currentSlideSize) { 3249 momentumDuration = params.speed * 1.5; 3250 } else { 3251 momentumDuration = params.speed * 2.5; 3252 } 3253 } 3254 } else if (params.freeModeSticky) { 3255 swiper.slideToClosest(); 3256 return; 3257 } 3258 3259 if (params.freeModeMomentumBounce && doBounce) { 3260 swiper.updateProgress(afterBouncePosition); 3261 swiper.setTransition(momentumDuration); 3262 swiper.setTranslate(newPosition); 3263 swiper.transitionStart(true, swiper.swipeDirection); 3264 swiper.animating = true; 3265 $wrapperEl.transitionEnd(function () { 3266 if (!swiper || swiper.destroyed || !data.allowMomentumBounce) { return; } 3267 swiper.emit('momentumBounce'); 3268 3269 swiper.setTransition(params.speed); 3270 swiper.setTranslate(afterBouncePosition); 3271 $wrapperEl.transitionEnd(function () { 3272 if (!swiper || swiper.destroyed) { return; } 3273 swiper.transitionEnd(); 3274 }); 3275 }); 3276 } else if (swiper.velocity) { 3277 swiper.updateProgress(newPosition); 3278 swiper.setTransition(momentumDuration); 3279 swiper.setTranslate(newPosition); 3280 swiper.transitionStart(true, swiper.swipeDirection); 3281 if (!swiper.animating) { 3282 swiper.animating = true; 3283 $wrapperEl.transitionEnd(function () { 3284 if (!swiper || swiper.destroyed) { return; } 3285 swiper.transitionEnd(); 3286 }); 3287 } 3288 } else { 3289 swiper.updateProgress(newPosition); 3290 } 3291 3292 swiper.updateActiveIndex(); 3293 swiper.updateSlidesClasses(); 3294 } else if (params.freeModeSticky) { 3295 swiper.slideToClosest(); 3296 return; 3297 } 3298 3299 if (!params.freeModeMomentum || timeDiff >= params.longSwipesMs) { 3300 swiper.updateProgress(); 3301 swiper.updateActiveIndex(); 3302 swiper.updateSlidesClasses(); 3303 } 3304 return; 3305 } 3306 3307 // Find current slide 3308 var stopIndex = 0; 3309 var groupSize = swiper.slidesSizesGrid[0]; 3310 for (var i = 0; i < slidesGrid.length; i += params.slidesPerGroup) { 3311 if (typeof slidesGrid[i + params.slidesPerGroup] !== 'undefined') { 3312 if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + params.slidesPerGroup]) { 3313 stopIndex = i; 3314 groupSize = slidesGrid[i + params.slidesPerGroup] - slidesGrid[i]; 3315 } 3316 } else if (currentPos >= slidesGrid[i]) { 3317 stopIndex = i; 3318 groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2]; 3319 } 3320 } 3321 3322 // Find current slide size 3323 var ratio = (currentPos - slidesGrid[stopIndex]) / groupSize; 3324 3325 if (timeDiff > params.longSwipesMs) { 3326 // Long touches 3327 if (!params.longSwipes) { 3328 swiper.slideTo(swiper.activeIndex); 3329 return; 3330 } 3331 if (swiper.swipeDirection === 'next') { 3332 if (ratio >= params.longSwipesRatio) { swiper.slideTo(stopIndex + params.slidesPerGroup); } 3333 else { swiper.slideTo(stopIndex); } 3334 } 3335 if (swiper.swipeDirection === 'prev') { 3336 if (ratio > (1 - params.longSwipesRatio)) { swiper.slideTo(stopIndex + params.slidesPerGroup); } 3337 else { swiper.slideTo(stopIndex); } 3338 } 3339 } else { 3340 // Short swipes 3341 if (!params.shortSwipes) { 3342 swiper.slideTo(swiper.activeIndex); 3343 return; 3344 } 3345 var isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl); 3346 if (!isNavButtonTarget) { 3347 if (swiper.swipeDirection === 'next') { 3348 swiper.slideTo(stopIndex + params.slidesPerGroup); 3349 } 3350 if (swiper.swipeDirection === 'prev') { 3351 swiper.slideTo(stopIndex); 3352 } 3353 } else if (e.target === swiper.navigation.nextEl) { 3354 swiper.slideTo(stopIndex + params.slidesPerGroup); 3355 } else { 3356 swiper.slideTo(stopIndex); 3357 } 3358 } 3359 } 3360 3361 function onResize () { 3362 var swiper = this; 3363 3364 var params = swiper.params; 3365 var el = swiper.el; 3366 3367 if (el && el.offsetWidth === 0) { return; } 3368
vendor: 5,401 bytes, lines 3369-3520
3369 // Breakpoints 3370 if (params.breakpoints) { 3371 swiper.setBreakpoint(); 3372 } 3373 3374 // Save locks 3375 var allowSlideNext = swiper.allowSlideNext; 3376 var allowSlidePrev = swiper.allowSlidePrev; 3377 var snapGrid = swiper.snapGrid; 3378 3379 // Disable locks on resize 3380 swiper.allowSlideNext = true; 3381 swiper.allowSlidePrev = true; 3382 3383 swiper.updateSize(); 3384 swiper.updateSlides(); 3385 3386 swiper.updateSlidesClasses(); 3387 if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.params.centeredSlides) { 3388 swiper.slideTo(swiper.slides.length - 1, 0, false, true); 3389 } else { 3390 swiper.slideTo(swiper.activeIndex, 0, false, true); 3391 } 3392 3393 if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) { 3394 swiper.autoplay.run(); 3395 } 3396 // Return locks after resize 3397 swiper.allowSlidePrev = allowSlidePrev; 3398 swiper.allowSlideNext = allowSlideNext; 3399 3400 if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) { 3401 swiper.checkOverflow(); 3402 } 3403 } 3404 3405 function onClick (e) { 3406 var swiper = this; 3407 if (!swiper.allowClick) { 3408 if (swiper.params.preventClicks) { e.preventDefault(); } 3409 if (swiper.params.preventClicksPropagation && swiper.animating) { 3410 e.stopPropagation(); 3411 e.stopImmediatePropagation(); 3412 } 3413 } 3414 } 3415 3416 function onScroll () { 3417 var swiper = this; 3418 var wrapperEl = swiper.wrapperEl; 3419 swiper.previousTranslate = swiper.translate; 3420 swiper.translate = swiper.isHorizontal() ? -wrapperEl.scrollLeft : -wrapperEl.scrollTop; 3421 // eslint-disable-next-line 3422 if (swiper.translate === -0) { swiper.translate = 0; } 3423 3424 swiper.updateActiveIndex(); 3425 swiper.updateSlidesClasses(); 3426 3427 var newProgress; 3428 var translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 3429 if (translatesDiff === 0) { 3430 newProgress = 0; 3431 } else { 3432 newProgress = (swiper.translate - swiper.minTranslate()) / (translatesDiff); 3433 } 3434 if (newProgress !== swiper.progress) { 3435 swiper.updateProgress(swiper.translate); 3436 } 3437 3438 swiper.emit('setTranslate', swiper.translate, false); 3439 } 3440 3441 var dummyEventAttached = false; 3442 function dummyEventListener() {} 3443 3444 function attachEvents() { 3445 var swiper = this; 3446 var params = swiper.params; 3447 var touchEvents = swiper.touchEvents; 3448 var el = swiper.el; 3449 var wrapperEl = swiper.wrapperEl; 3450 3451 swiper.onTouchStart = onTouchStart.bind(swiper); 3452 swiper.onTouchMove = onTouchMove.bind(swiper); 3453 swiper.onTouchEnd = onTouchEnd.bind(swiper); 3454 if (params.cssMode) { 3455 swiper.onScroll = onScroll.bind(swiper); 3456 } 3457 3458 swiper.onClick = onClick.bind(swiper); 3459 3460 var capture = !!params.nested; 3461 3462 // Touch Events 3463 if (!Support.touch && Support.pointerEvents) { 3464 el.addEventListener(touchEvents.start, swiper.onTouchStart, false); 3465 doc.addEventListener(touchEvents.move, swiper.onTouchMove, capture); 3466 doc.addEventListener(touchEvents.end, swiper.onTouchEnd, false); 3467 } else { 3468 if (Support.touch) { 3469 var passiveListener = touchEvents.start === 'touchstart' && Support.passiveListener && params.passiveListeners ? { passive: true, capture: false } : false; 3470 el.addEventListener(touchEvents.start, swiper.onTouchStart, passiveListener); 3471 el.addEventListener(touchEvents.move, swiper.onTouchMove, Support.passiveListener ? { passive: false, capture: capture } : capture); 3472 el.addEventListener(touchEvents.end, swiper.onTouchEnd, passiveListener); 3473 if (touchEvents.cancel) { 3474 el.addEventListener(touchEvents.cancel, swiper.onTouchEnd, passiveListener); 3475 } 3476 if (!dummyEventAttached) { 3477 doc.addEventListener('touchstart', dummyEventListener); 3478 dummyEventAttached = true; 3479 } 3480 } 3481 if ((params.simulateTouch && !Device.ios && !Device.android) || (params.simulateTouch && !Support.touch && Device.ios)) { 3482 el.addEventListener('mousedown', swiper.onTouchStart, false); 3483 doc.addEventListener('mousemove', swiper.onTouchMove, capture); 3484 doc.addEventListener('mouseup', swiper.onTouchEnd, false); 3485 } 3486 } 3487 // Prevent Links Clicks 3488 if (params.preventClicks || params.preventClicksPropagation) { 3489 el.addEventListener('click', swiper.onClick, true); 3490 } 3491 if (params.cssMode) { 3492 wrapperEl.addEventListener('scroll', swiper.onScroll); 3493 } 3494 3495 // Resize handler 3496 if (params.updateOnWindowResize) { 3497 swiper.on((Device.ios || Device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate'), onResize, true); 3498 } else { 3499 swiper.on('observerUpdate', onResize, true); 3500 } 3501 } 3502 3503 function detachEvents() { 3504 var swiper = this; 3505 3506 var params = swiper.params; 3507 var touchEvents = swiper.touchEvents; 3508 var el = swiper.el; 3509 var wrapperEl = swiper.wrapperEl; 3510 3511 var capture = !!params.nested; 3512 3513 // Touch Events 3514 if (!Support.touch && Support.pointerEvents) { 3515 el.removeEventListener(touchEvents.start, swiper.onTouchStart, false); 3516 doc.removeEventListener(touchEvents.move, swiper.onTouchMove, capture); 3517 doc.removeEventListener(touchEvents.end, swiper.onTouchEnd, false); 3518 } else { 3519 if (Support.touch) { 3520 var passiveListener = touchEvents.start === 'onTouchStart' && Support.passiveListener && params.passiveListeners ? { passive: true, capture: false } : false;
vendor: 26,808 bytes, lines 3521-4432
3521 el.removeEventListener(touchEvents.start, swiper.onTouchStart, passiveListener); 3522 el.removeEventListener(touchEvents.move, swiper.onTouchMove, capture); 3523 el.removeEventListener(touchEvents.end, swiper.onTouchEnd, passiveListener); 3524 if (touchEvents.cancel) { 3525 el.removeEventListener(touchEvents.cancel, swiper.onTouchEnd, passiveListener); 3526 } 3527 } 3528 if ((params.simulateTouch && !Device.ios && !Device.android) || (params.simulateTouch && !Support.touch && Device.ios)) { 3529 el.removeEventListener('mousedown', swiper.onTouchStart, false); 3530 doc.removeEventListener('mousemove', swiper.onTouchMove, capture); 3531 doc.removeEventListener('mouseup', swiper.onTouchEnd, false); 3532 } 3533 } 3534 // Prevent Links Clicks 3535 if (params.preventClicks || params.preventClicksPropagation) { 3536 el.removeEventListener('click', swiper.onClick, true); 3537 } 3538 3539 if (params.cssMode) { 3540 wrapperEl.removeEventListener('scroll', swiper.onScroll); 3541 } 3542 3543 // Resize handler 3544 swiper.off((Device.ios || Device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate'), onResize); 3545 } 3546 3547 var events = { 3548 attachEvents: attachEvents, 3549 detachEvents: detachEvents, 3550 }; 3551 3552 function setBreakpoint () { 3553 var swiper = this; 3554 var activeIndex = swiper.activeIndex; 3555 var initialized = swiper.initialized; 3556 var loopedSlides = swiper.loopedSlides; if ( loopedSlides === void 0 ) loopedSlides = 0; 3557 var params = swiper.params; 3558 var $el = swiper.$el; 3559 var breakpoints = params.breakpoints; 3560 if (!breakpoints || (breakpoints && Object.keys(breakpoints).length === 0)) { return; } 3561 3562 // Get breakpoint for window width and update parameters 3563 var breakpoint = swiper.getBreakpoint(breakpoints); 3564 3565 if (breakpoint && swiper.currentBreakpoint !== breakpoint) { 3566 var breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined; 3567 if (breakpointOnlyParams) { 3568 ['slidesPerView', 'spaceBetween', 'slidesPerGroup', 'slidesPerColumn'].forEach(function (param) { 3569 var paramValue = breakpointOnlyParams[param]; 3570 if (typeof paramValue === 'undefined') { return; } 3571 if (param === 'slidesPerView' && (paramValue === 'AUTO' || paramValue === 'auto')) { 3572 breakpointOnlyParams[param] = 'auto'; 3573 } else if (param === 'slidesPerView') { 3574 breakpointOnlyParams[param] = parseFloat(paramValue); 3575 } else { 3576 breakpointOnlyParams[param] = parseInt(paramValue, 10); 3577 } 3578 }); 3579 } 3580 3581 var breakpointParams = breakpointOnlyParams || swiper.originalParams; 3582 var wasMultiRow = params.slidesPerColumn > 1; 3583 var isMultiRow = breakpointParams.slidesPerColumn > 1; 3584 if (wasMultiRow && !isMultiRow) { 3585 $el.removeClass(((params.containerModifierClass) + "multirow " + (params.containerModifierClass) + "multirow-column")); 3586 } else if (!wasMultiRow && isMultiRow) { 3587 $el.addClass(((params.containerModifierClass) + "multirow")); 3588 if (breakpointParams.slidesPerColumnFill === 'column') { 3589 $el.addClass(((params.containerModifierClass) + "multirow-column")); 3590 } 3591 } 3592 3593 var directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction; 3594 var needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged); 3595 3596 if (directionChanged && initialized) { 3597 swiper.changeDirection(); 3598 } 3599 3600 Utils.extend(swiper.params, breakpointParams); 3601 3602 Utils.extend(swiper, { 3603 allowTouchMove: swiper.params.allowTouchMove, 3604 allowSlideNext: swiper.params.allowSlideNext, 3605 allowSlidePrev: swiper.params.allowSlidePrev, 3606 }); 3607 3608 swiper.currentBreakpoint = breakpoint; 3609 3610 if (needsReLoop && initialized) { 3611 swiper.loopDestroy(); 3612 swiper.loopCreate(); 3613 swiper.updateSlides(); 3614 swiper.slideTo((activeIndex - loopedSlides) + swiper.loopedSlides, 0, false); 3615 } 3616 3617 swiper.emit('breakpoint', breakpointParams); 3618 } 3619 } 3620 3621 function getBreakpoint (breakpoints) { 3622 // Get breakpoint for window width 3623 if (!breakpoints) { return undefined; } 3624 var breakpoint = false; 3625 var points = []; 3626 Object.keys(breakpoints).forEach(function (point) { 3627 points.push(point); 3628 }); 3629 points.sort(function (a, b) { return parseInt(a, 10) - parseInt(b, 10); }); 3630 for (var i = 0; i < points.length; i += 1) { 3631 var point = points[i]; 3632 if (point <= win.innerWidth) { 3633 breakpoint = point; 3634 } 3635 } 3636 return breakpoint || 'max'; 3637 } 3638 3639 var breakpoints = { setBreakpoint: setBreakpoint, getBreakpoint: getBreakpoint }; 3640 3641 function addClasses () { 3642 var swiper = this; 3643 var classNames = swiper.classNames; 3644 var params = swiper.params; 3645 var rtl = swiper.rtl; 3646 var $el = swiper.$el; 3647 var suffixes = []; 3648 3649 suffixes.push('initialized'); 3650 suffixes.push(params.direction); 3651 3652 if (params.freeMode) { 3653 suffixes.push('free-mode'); 3654 } 3655 if (params.autoHeight) { 3656 suffixes.push('autoheight'); 3657 } 3658 if (rtl) { 3659 suffixes.push('rtl'); 3660 } 3661 if (params.slidesPerColumn > 1) { 3662 suffixes.push('multirow'); 3663 if (params.slidesPerColumnFill === 'column') { 3664 suffixes.push('multirow-column'); 3665 } 3666 } 3667 if (Device.android) { 3668 suffixes.push('android'); 3669 } 3670 if (Device.ios) { 3671 suffixes.push('ios'); 3672 } 3673 3674 if (params.cssMode) { 3675 suffixes.push('css-mode'); 3676 } 3677 3678 suffixes.forEach(function (suffix) { 3679 classNames.push(params.containerModifierClass + suffix); 3680 }); 3681 3682 $el.addClass(classNames.join(' ')); 3683 } 3684 3685 function removeClasses () { 3686 var swiper = this; 3687 var $el = swiper.$el; 3688 var classNames = swiper.classNames; 3689 3690 $el.removeClass(classNames.join(' ')); 3691 } 3692 3693 var classes = { addClasses: addClasses, removeClasses: removeClasses }; 3694 3695 function loadImage (imageEl, src, srcset, sizes, checkForComplete, callback) { 3696 var image; 3697 function onReady() { 3698 if (callback) { callback(); } 3699 } 3700 if (!imageEl.complete || !checkForComplete) { 3701 if (src) { 3702 image = new win.Image(); 3703 image.onload = onReady; 3704 image.onerror = onReady; 3705 if (sizes) { 3706 image.sizes = sizes; 3707 } 3708 if (srcset) { 3709 image.srcset = srcset; 3710 } 3711 if (src) { 3712 image.src = src; 3713 } 3714 } else { 3715 onReady(); 3716 } 3717 } else { 3718 // image already loaded... 3719 onReady(); 3720 } 3721 } 3722 3723 function preloadImages () { 3724 var swiper = this; 3725 swiper.imagesToLoad = swiper.$el.find('img'); 3726 function onReady() { 3727 if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper.destroyed) { return; } 3728 if (swiper.imagesLoaded !== undefined) { swiper.imagesLoaded += 1; } 3729 if (swiper.imagesLoaded === swiper.imagesToLoad.length) { 3730 if (swiper.params.updateOnImagesReady) { swiper.update(); } 3731 swiper.emit('imagesReady'); 3732 } 3733 } 3734 for (var i = 0; i < swiper.imagesToLoad.length; i += 1) { 3735 var imageEl = swiper.imagesToLoad[i]; 3736 swiper.loadImage( 3737 imageEl, 3738 imageEl.currentSrc || imageEl.getAttribute('src'), 3739 imageEl.srcset || imageEl.getAttribute('srcset'), 3740 imageEl.sizes || imageEl.getAttribute('sizes'), 3741 true, 3742 onReady 3743 ); 3744 } 3745 } 3746 3747 var images = { 3748 loadImage: loadImage, 3749 preloadImages: preloadImages, 3750 }; 3751 3752 function checkOverflow() { 3753 var swiper = this; 3754 var params = swiper.params; 3755 var wasLocked = swiper.isLocked; 3756 var lastSlidePosition = swiper.slides.length > 0 && (params.slidesOffsetBefore + (params.spaceBetween * (swiper.slides.length - 1)) + ((swiper.slides[0]).offsetWidth) * swiper.slides.length); 3757 3758 if (params.slidesOffsetBefore && params.slidesOffsetAfter && lastSlidePosition) { 3759 swiper.isLocked = lastSlidePosition <= swiper.size; 3760 } else { 3761 swiper.isLocked = swiper.snapGrid.length === 1; 3762 } 3763 3764 swiper.allowSlideNext = !swiper.isLocked; 3765 swiper.allowSlidePrev = !swiper.isLocked; 3766 3767 // events 3768 if (wasLocked !== swiper.isLocked) { swiper.emit(swiper.isLocked ? 'lock' : 'unlock'); } 3769 3770 if (wasLocked && wasLocked !== swiper.isLocked) { 3771 swiper.isEnd = false; 3772 swiper.navigation.update(); 3773 } 3774 } 3775 3776 var checkOverflow$1 = { checkOverflow: checkOverflow }; 3777 3778 var defaults = { 3779 init: true, 3780 direction: 'horizontal', 3781 touchEventsTarget: 'container', 3782 initialSlide: 0, 3783 speed: 300, 3784 cssMode: false, 3785 updateOnWindowResize: true, 3786 // 3787 preventInteractionOnTransition: false, 3788 3789 // To support iOS's swipe-to-go-back gesture (when being used in-app, with UIWebView). 3790 edgeSwipeDetection: false, 3791 edgeSwipeThreshold: 20, 3792 3793 // Free mode 3794 freeMode: false, 3795 freeModeMomentum: true, 3796 freeModeMomentumRatio: 1, 3797 freeModeMomentumBounce: true, 3798 freeModeMomentumBounceRatio: 1, 3799 freeModeMomentumVelocityRatio: 1, 3800 freeModeSticky: false, 3801 freeModeMinimumVelocity: 0.02, 3802 3803 // Autoheight 3804 autoHeight: false, 3805 3806 // Set wrapper width 3807 setWrapperSize: false, 3808 3809 // Virtual Translate 3810 virtualTranslate: false, 3811 3812 // Effects 3813 effect: 'slide', // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip' 3814 3815 // Breakpoints 3816 breakpoints: undefined, 3817 3818 // Slides grid 3819 spaceBetween: 0, 3820 slidesPerView: 1, 3821 slidesPerColumn: 1, 3822 slidesPerColumnFill: 'column', 3823 slidesPerGroup: 1, 3824 centeredSlides: false, 3825 centeredSlidesBounds: false, 3826 slidesOffsetBefore: 0, // in px 3827 slidesOffsetAfter: 0, // in px 3828 normalizeSlideIndex: true, 3829 centerInsufficientSlides: false, 3830 3831 // Disable swiper and hide navigation when container not overflow 3832 watchOverflow: false, 3833 3834 // Round length 3835 roundLengths: false, 3836 3837 // Touches 3838 touchRatio: 1, 3839 touchAngle: 45, 3840 simulateTouch: true, 3841 shortSwipes: true, 3842 longSwipes: true, 3843 longSwipesRatio: 0.5, 3844 longSwipesMs: 300, 3845 followFinger: true, 3846 allowTouchMove: true, 3847 threshold: 0, 3848 touchMoveStopPropagation: false, 3849 touchStartPreventDefault: true, 3850 touchStartForcePreventDefault: false, 3851 touchReleaseOnEdges: false, 3852 3853 // Unique Navigation Elements 3854 uniqueNavElements: true, 3855 3856 // Resistance 3857 resistance: true, 3858 resistanceRatio: 0.85, 3859 3860 // Progress 3861 watchSlidesProgress: false, 3862 watchSlidesVisibility: false, 3863 3864 // Cursor 3865 grabCursor: false, 3866 3867 // Clicks 3868 preventClicks: true, 3869 preventClicksPropagation: true, 3870 slideToClickedSlide: false, 3871 3872 // Images 3873 preloadImages: true, 3874 updateOnImagesReady: true, 3875 3876 // loop 3877 loop: false, 3878 loopAdditionalSlides: 0, 3879 loopedSlides: null, 3880 loopFillGroupWithBlank: false, 3881 3882 // Swiping/no swiping 3883 allowSlidePrev: true, 3884 allowSlideNext: true, 3885 swipeHandler: null, // '.swipe-handler', 3886 noSwiping: true, 3887 noSwipingClass: 'swiper-no-swiping', 3888 noSwipingSelector: null, 3889 3890 // Passive Listeners 3891 passiveListeners: true, 3892 3893 // NS 3894 containerModifierClass: 'swiper-container-', // NEW 3895 slideClass: 'swiper-slide', 3896 slideBlankClass: 'swiper-slide-invisible-blank', 3897 slideActiveClass: 'swiper-slide-active', 3898 slideDuplicateActiveClass: 'swiper-slide-duplicate-active', 3899 slideVisibleClass: 'swiper-slide-visible', 3900 slideDuplicateClass: 'swiper-slide-duplicate', 3901 slideNextClass: 'swiper-slide-next', 3902 slideDuplicateNextClass: 'swiper-slide-duplicate-next', 3903 slidePrevClass: 'swiper-slide-prev', 3904 slideDuplicatePrevClass: 'swiper-slide-duplicate-prev', 3905 wrapperClass: 'swiper-wrapper', 3906 3907 // Callbacks 3908 runCallbacksOnInit: true, 3909 }; 3910 3911 /* eslint no-param-reassign: "off" */ 3912 3913 var prototypes = { 3914 update: update, 3915 translate: translate, 3916 transition: transition$1, 3917 slide: slide, 3918 loop: loop, 3919 grabCursor: grabCursor, 3920 manipulation: manipulation, 3921 events: events, 3922 breakpoints: breakpoints, 3923 checkOverflow: checkOverflow$1, 3924 classes: classes, 3925 images: images, 3926 }; 3927 3928 var extendedDefaults = {}; 3929 3930 var Swiper = /*@__PURE__*/(function (SwiperClass) { 3931 function Swiper() { 3932 var assign; 3933 3934 var args = [], len = arguments.length; 3935 while ( len-- ) args[ len ] = arguments[ len ]; 3936 var el; 3937 var params; 3938 if (args.length === 1 && args[0].constructor && args[0].constructor === Object) { 3939 params = args[0]; 3940 } else { 3941 (assign = args, el = assign[0], params = assign[1]); 3942 } 3943 if (!params) { params = {}; } 3944 3945 params = Utils.extend({}, params); 3946 if (el && !params.el) { params.el = el; } 3947 3948 SwiperClass.call(this, params); 3949 3950 Object.keys(prototypes).forEach(function (prototypeGroup) { 3951 Object.keys(prototypes[prototypeGroup]).forEach(function (protoMethod) { 3952 if (!Swiper.prototype[protoMethod]) { 3953 Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod]; 3954 } 3955 }); 3956 }); 3957 3958 // Swiper Instance 3959 var swiper = this; 3960 if (typeof swiper.modules === 'undefined') { 3961 swiper.modules = {}; 3962 } 3963 Object.keys(swiper.modules).forEach(function (moduleName) { 3964 var module = swiper.modules[moduleName]; 3965 if (module.params) { 3966 var moduleParamName = Object.keys(module.params)[0]; 3967 var moduleParams = module.params[moduleParamName]; 3968 if (typeof moduleParams !== 'object' || moduleParams === null) { return; } 3969 if (!(moduleParamName in params && 'enabled' in moduleParams)) { return; } 3970 if (params[moduleParamName] === true) { 3971 params[moduleParamName] = { enabled: true }; 3972 } 3973 if ( 3974 typeof params[moduleParamName] === 'object' 3975 && !('enabled' in params[moduleParamName]) 3976 ) { 3977 params[moduleParamName].enabled = true; 3978 } 3979 if (!params[moduleParamName]) { params[moduleParamName] = { enabled: false }; } 3980 } 3981 }); 3982 3983 // Extend defaults with modules params 3984 var swiperParams = Utils.extend({}, defaults); 3985 swiper.useModulesParams(swiperParams); 3986 3987 // Extend defaults with passed params 3988 swiper.params = Utils.extend({}, swiperParams, extendedDefaults, params); 3989 swiper.originalParams = Utils.extend({}, swiper.params); 3990 swiper.passedParams = Utils.extend({}, params); 3991 3992 // Save Dom lib 3993 swiper.$ = $; 3994 3995 // Find el 3996 var $el = $(swiper.params.el); 3997 el = $el[0]; 3998 3999 if (!el) { 4000 return undefined; 4001 } 4002 4003 if ($el.length > 1) { 4004 var swipers = []; 4005 $el.each(function (index, containerEl) { 4006 var newParams = Utils.extend({}, params, { el: containerEl }); 4007 swipers.push(new Swiper(newParams)); 4008 }); 4009 return swipers; 4010 } 4011 4012 el.swiper = swiper; 4013 $el.data('swiper', swiper); 4014 4015 // Find Wrapper 4016 var $wrapperEl; 4017 if (el && el.shadowRoot && el.shadowRoot.querySelector) { 4018 $wrapperEl = $(el.shadowRoot.querySelector(("." + (swiper.params.wrapperClass)))); 4019 // Children needs to return slot items 4020 $wrapperEl.children = function (options) { return $el.children(options); }; 4021 } else { 4022 $wrapperEl = $el.children(("." + (swiper.params.wrapperClass))); 4023 } 4024 // Extend Swiper 4025 Utils.extend(swiper, { 4026 $el: $el, 4027 el: el, 4028 $wrapperEl: $wrapperEl, 4029 wrapperEl: $wrapperEl[0], 4030 4031 // Classes 4032 classNames: [], 4033 4034 // Slides 4035 slides: $(), 4036 slidesGrid: [], 4037 snapGrid: [], 4038 slidesSizesGrid: [], 4039 4040 // isDirection 4041 isHorizontal: function isHorizontal() { 4042 return swiper.params.direction === 'horizontal'; 4043 }, 4044 isVertical: function isVertical() { 4045 return swiper.params.direction === 'vertical'; 4046 }, 4047 // RTL 4048 rtl: (el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl'), 4049 rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl'), 4050 wrongRTL: $wrapperEl.css('display') === '-webkit-box', 4051 4052 // Indexes 4053 activeIndex: 0, 4054 realIndex: 0, 4055 4056 // 4057 isBeginning: true, 4058 isEnd: false, 4059 4060 // Props 4061 translate: 0, 4062 previousTranslate: 0, 4063 progress: 0, 4064 velocity: 0, 4065 animating: false, 4066 4067 // Locks 4068 allowSlideNext: swiper.params.allowSlideNext, 4069 allowSlidePrev: swiper.params.allowSlidePrev, 4070 4071 // Touch Events 4072 touchEvents: (function touchEvents() { 4073 var touch = ['touchstart', 'touchmove', 'touchend', 'touchcancel']; 4074 var desktop = ['mousedown', 'mousemove', 'mouseup']; 4075 if (Support.pointerEvents) { 4076 desktop = ['pointerdown', 'pointermove', 'pointerup']; 4077 } 4078 swiper.touchEventsTouch = { 4079 start: touch[0], 4080 move: touch[1], 4081 end: touch[2], 4082 cancel: touch[3], 4083 }; 4084 swiper.touchEventsDesktop = { 4085 start: desktop[0], 4086 move: desktop[1], 4087 end: desktop[2], 4088 }; 4089 return Support.touch || !swiper.params.simulateTouch ? swiper.touchEventsTouch : swiper.touchEventsDesktop; 4090 }()), 4091 touchEventsData: { 4092 isTouched: undefined, 4093 isMoved: undefined, 4094 allowTouchCallbacks: undefined, 4095 touchStartTime: undefined, 4096 isScrolling: undefined, 4097 currentTranslate: undefined, 4098 startTranslate: undefined, 4099 allowThresholdMove: undefined, 4100 // Form elements to match 4101 formElements: 'input, select, option, textarea, button, video', 4102 // Last click time 4103 lastClickTime: Utils.now(), 4104 clickTimeout: undefined, 4105 // Velocities 4106 velocities: [], 4107 allowMomentumBounce: undefined, 4108 isTouchEvent: undefined, 4109 startMoving: undefined, 4110 }, 4111 4112 // Clicks 4113 allowClick: true, 4114 4115 // Touches 4116 allowTouchMove: swiper.params.allowTouchMove, 4117 4118 touches: { 4119 startX: 0, 4120 startY: 0, 4121 currentX: 0, 4122 currentY: 0, 4123 diff: 0, 4124 }, 4125 4126 // Images 4127 imagesToLoad: [], 4128 imagesLoaded: 0, 4129 4130 }); 4131 4132 // Install Modules 4133 swiper.useModules(); 4134 4135 // Init 4136 if (swiper.params.init) { 4137 swiper.init(); 4138 } 4139 4140 // Return app instance 4141 return swiper; 4142 } 4143 4144 if ( SwiperClass ) Swiper.__proto__ = SwiperClass; 4145 Swiper.prototype = Object.create( SwiperClass && SwiperClass.prototype ); 4146 Swiper.prototype.constructor = Swiper; 4147 4148 var staticAccessors = { extendedDefaults: { configurable: true },defaults: { configurable: true },Class: { configurable: true },$: { configurable: true } }; 4149 4150 Swiper.prototype.slidesPerViewDynamic = function slidesPerViewDynamic () { 4151 var swiper = this; 4152 var params = swiper.params; 4153 var slides = swiper.slides; 4154 var slidesGrid = swiper.slidesGrid; 4155 var swiperSize = swiper.size; 4156 var activeIndex = swiper.activeIndex; 4157 var spv = 1; 4158 if (params.centeredSlides) { 4159 var slideSize = slides[activeIndex].swiperSlideSize; 4160 var breakLoop; 4161 for (var i = activeIndex + 1; i < slides.length; i += 1) { 4162 if (slides[i] && !breakLoop) { 4163 slideSize += slides[i].swiperSlideSize; 4164 spv += 1; 4165 if (slideSize > swiperSize) { breakLoop = true; } 4166 } 4167 } 4168 for (var i$1 = activeIndex - 1; i$1 >= 0; i$1 -= 1) { 4169 if (slides[i$1] && !breakLoop) { 4170 slideSize += slides[i$1].swiperSlideSize; 4171 spv += 1; 4172 if (slideSize > swiperSize) { breakLoop = true; } 4173 } 4174 } 4175 } else { 4176 for (var i$2 = activeIndex + 1; i$2 < slides.length; i$2 += 1) { 4177 if (slidesGrid[i$2] - slidesGrid[activeIndex] < swiperSize) { 4178 spv += 1; 4179 } 4180 } 4181 } 4182 return spv; 4183 }; 4184 4185 Swiper.prototype.update = function update () { 4186 var swiper = this; 4187 if (!swiper || swiper.destroyed) { return; } 4188 var snapGrid = swiper.snapGrid; 4189 var params = swiper.params; 4190 // Breakpoints 4191 if (params.breakpoints) { 4192 swiper.setBreakpoint(); 4193 } 4194 swiper.updateSize(); 4195 swiper.updateSlides(); 4196 swiper.updateProgress(); 4197 swiper.updateSlidesClasses(); 4198 4199 function setTranslate() { 4200 var translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate; 4201 var newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate()); 4202 swiper.setTranslate(newTranslate); 4203 swiper.updateActiveIndex(); 4204 swiper.updateSlidesClasses(); 4205 } 4206 var translated; 4207 if (swiper.params.freeMode) { 4208 setTranslate(); 4209 if (swiper.params.autoHeight) { 4210 swiper.updateAutoHeight(); 4211 } 4212 } else { 4213 if ((swiper.params.slidesPerView === 'auto' || swiper.params.slidesPerView > 1) && swiper.isEnd && !swiper.params.centeredSlides) { 4214 translated = swiper.slideTo(swiper.slides.length - 1, 0, false, true); 4215 } else { 4216 translated = swiper.slideTo(swiper.activeIndex, 0, false, true); 4217 } 4218 if (!translated) { 4219 setTranslate(); 4220 } 4221 } 4222 if (params.watchOverflow && snapGrid !== swiper.snapGrid) { 4223 swiper.checkOverflow(); 4224 } 4225 swiper.emit('update'); 4226 }; 4227 4228 Swiper.prototype.changeDirection = function changeDirection (newDirection, needUpdate) { 4229 if ( needUpdate === void 0 ) needUpdate = true; 4230 4231 var swiper = this; 4232 var currentDirection = swiper.params.direction; 4233 if (!newDirection) { 4234 // eslint-disable-next-line 4235 newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal'; 4236 } 4237 if ((newDirection === currentDirection) || (newDirection !== 'horizontal' && newDirection !== 'vertical')) { 4238 return swiper; 4239 } 4240 4241 swiper.$el 4242 .removeClass(("" + (swiper.params.containerModifierClass) + currentDirection)) 4243 .addClass(("" + (swiper.params.containerModifierClass) + newDirection)); 4244 4245 swiper.params.direction = newDirection; 4246 4247 swiper.slides.each(function (slideIndex, slideEl) { 4248 if (newDirection === 'vertical') { 4249 slideEl.style.width = ''; 4250 } else { 4251 slideEl.style.height = ''; 4252 } 4253 }); 4254 4255 swiper.emit('changeDirection'); 4256 if (needUpdate) { swiper.update(); } 4257 4258 return swiper; 4259 }; 4260 4261 Swiper.prototype.init = function init () { 4262 var swiper = this; 4263 if (swiper.initialized) { return; } 4264 4265 swiper.emit('beforeInit'); 4266 4267 // Set breakpoint 4268 if (swiper.params.breakpoints) { 4269 swiper.setBreakpoint(); 4270 } 4271 4272 // Add Classes 4273 swiper.addClasses(); 4274 4275 // Create loop 4276 if (swiper.params.loop) { 4277 swiper.loopCreate(); 4278 } 4279 4280 // Update size 4281 swiper.updateSize(); 4282 4283 // Update slides 4284 swiper.updateSlides(); 4285 4286 if (swiper.params.watchOverflow) { 4287 swiper.checkOverflow(); 4288 } 4289 4290 // Set Grab Cursor 4291 if (swiper.params.grabCursor) { 4292 swiper.setGrabCursor(); 4293 } 4294 4295 if (swiper.params.preloadImages) { 4296 swiper.preloadImages(); 4297 } 4298 4299 // Slide To Initial Slide 4300 if (swiper.params.loop) { 4301 swiper.slideTo(swiper.params.initialSlide + swiper.loopedSlides, 0, swiper.params.runCallbacksOnInit); 4302 } else { 4303 swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit); 4304 } 4305 4306 // Attach events 4307 swiper.attachEvents(); 4308 4309 // Init Flag 4310 swiper.initialized = true; 4311 4312 // Emit 4313 swiper.emit('init'); 4314 }; 4315 4316 Swiper.prototype.destroy = function destroy (deleteInstance, cleanStyles) { 4317 if ( deleteInstance === void 0 ) deleteInstance = true; 4318 if ( cleanStyles === void 0 ) cleanStyles = true; 4319 4320 var swiper = this; 4321 var params = swiper.params; 4322 var $el = swiper.$el; 4323 var $wrapperEl = swiper.$wrapperEl; 4324 var slides = swiper.slides; 4325 4326 if (typeof swiper.params === 'undefined' || swiper.destroyed) { 4327 return null; 4328 } 4329 4330 swiper.emit('beforeDestroy'); 4331 4332 // Init Flag 4333 swiper.initialized = false; 4334 4335 // Detach events 4336 swiper.detachEvents(); 4337 4338 // Destroy loop 4339 if (params.loop) { 4340 swiper.loopDestroy(); 4341 } 4342 4343 // Cleanup styles 4344 if (cleanStyles) { 4345 swiper.removeClasses(); 4346 $el.removeAttr('style'); 4347 $wrapperEl.removeAttr('style'); 4348 if (slides && slides.length) { 4349 slides 4350 .removeClass([ 4351 params.slideVisibleClass, 4352 params.slideActiveClass, 4353 params.slideNextClass, 4354 params.slidePrevClass ].join(' ')) 4355 .removeAttr('style') 4356 .removeAttr('data-swiper-slide-index'); 4357 } 4358 } 4359 4360 swiper.emit('destroy'); 4361 4362 // Detach emitter events 4363 Object.keys(swiper.eventsListeners).forEach(function (eventName) { 4364 swiper.off(eventName); 4365 }); 4366 4367 if (deleteInstance !== false) { 4368 swiper.$el[0].swiper = null; 4369 swiper.$el.data('swiper', null); 4370 Utils.deleteProps(swiper); 4371 } 4372 swiper.destroyed = true; 4373 4374 return null; 4375 }; 4376 4377 Swiper.extendDefaults = function extendDefaults (newDefaults) { 4378 Utils.extend(extendedDefaults, newDefaults); 4379 }; 4380 4381 staticAccessors.extendedDefaults.get = function () { 4382 return extendedDefaults; 4383 }; 4384 4385 staticAccessors.defaults.get = function () { 4386 return defaults; 4387 }; 4388 4389 staticAccessors.Class.get = function () { 4390 return SwiperClass; 4391 }; 4392 4393 staticAccessors.$.get = function () { 4394 return $; 4395 }; 4396 4397 Object.defineProperties( Swiper, staticAccessors ); 4398 4399 return Swiper; 4400 }(SwiperClass)); 4401 4402 var Device$1 = { 4403 name: 'device', 4404 proto: { 4405 device: Device, 4406 }, 4407 static: { 4408 device: Device, 4409 }, 4410 }; 4411 4412 var Support$1 = { 4413 name: 'support', 4414 proto: { 4415 support: Support, 4416 }, 4417 static: { 4418 support: Support, 4419 }, 4420 }; 4421 4422 var Browser = (function Browser() { 4423 function isSafari() { 4424 var ua = win.navigator.userAgent.toLowerCase(); 4425 return (ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0); 4426 } 4427 return { 4428 isEdge: !!win.navigator.userAgent.match(/Edge/g), 4429 isSafari: isSafari(), 4430 isUiWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(win.navigator.userAgent), 4431 }; 4432 }())
vendor: 9,655 bytes, lines 4432-4717
4432; 4433 4434 var Browser$1 = { 4435 name: 'browser', 4436 proto: { 4437 browser: Browser, 4438 }, 4439 static: { 4440 browser: Browser, 4441 }, 4442 }; 4443 4444 var Resize = { 4445 name: 'resize', 4446 create: function create() { 4447 var swiper = this; 4448 Utils.extend(swiper, { 4449 resize: { 4450 resizeHandler: function resizeHandler() { 4451 if (!swiper || swiper.destroyed || !swiper.initialized) { return; } 4452 swiper.emit('beforeResize'); 4453 swiper.emit('resize'); 4454 }, 4455 orientationChangeHandler: function orientationChangeHandler() { 4456 if (!swiper || swiper.destroyed || !swiper.initialized) { return; } 4457 swiper.emit('orientationchange'); 4458 }, 4459 }, 4460 }); 4461 }, 4462 on: { 4463 init: function init() { 4464 var swiper = this; 4465 // Emit resize 4466 win.addEventListener('resize', swiper.resize.resizeHandler); 4467 4468 // Emit orientationchange 4469 win.addEventListener('orientationchange', swiper.resize.orientationChangeHandler); 4470 }, 4471 destroy: function destroy() { 4472 var swiper = this; 4473 win.removeEventListener('resize', swiper.resize.resizeHandler); 4474 win.removeEventListener('orientationchange', swiper.resize.orientationChangeHandler); 4475 }, 4476 }, 4477 }; 4478 4479 var Observer = { 4480 func: win.MutationObserver || win.WebkitMutationObserver, 4481 attach: function attach(target, options) { 4482 if ( options === void 0 ) options = {}; 4483 4484 var swiper = this; 4485 4486 var ObserverFunc = Observer.func; 4487 var observer = new ObserverFunc(function (mutations) { 4488 // The observerUpdate event should only be triggered 4489 // once despite the number of mutations. Additional 4490 // triggers are redundant and are very costly 4491 if (mutations.length === 1) { 4492 swiper.emit('observerUpdate', mutations[0]); 4493 return; 4494 } 4495 var observerUpdate = function observerUpdate() { 4496 swiper.emit('observerUpdate', mutations[0]); 4497 }; 4498 4499 if (win.requestAnimationFrame) { 4500 win.requestAnimationFrame(observerUpdate); 4501 } else { 4502 win.setTimeout(observerUpdate, 0); 4503 } 4504 }); 4505 4506 observer.observe(target, { 4507 attributes: typeof options.attributes === 'undefined' ? true : options.attributes, 4508 childList: typeof options.childList === 'undefined' ? true : options.childList, 4509 characterData: typeof options.characterData === 'undefined' ? true : options.characterData, 4510 }); 4511 4512 swiper.observer.observers.push(observer); 4513 }, 4514 init: function init() { 4515 var swiper = this; 4516 if (!Support.observer || !swiper.params.observer) { return; } 4517 if (swiper.params.observeParents) { 4518 var containerParents = swiper.$el.parents(); 4519 for (var i = 0; i < containerParents.length; i += 1) { 4520 swiper.observer.attach(containerParents[i]); 4521 } 4522 } 4523 // Observe container 4524 swiper.observer.attach(swiper.$el[0], { childList: swiper.params.observeSlideChildren }); 4525 4526 // Observe wrapper 4527 swiper.observer.attach(swiper.$wrapperEl[0], { attributes: false }); 4528 }, 4529 destroy: function destroy() { 4530 var swiper = this; 4531 swiper.observer.observers.forEach(function (observer) { 4532 observer.disconnect(); 4533 }); 4534 swiper.observer.observers = []; 4535 }, 4536 }; 4537 4538 var Observer$1 = { 4539 name: 'observer', 4540 params: { 4541 observer: false, 4542 observeParents: false, 4543 observeSlideChildren: false, 4544 }, 4545 create: function create() { 4546 var swiper = this; 4547 Utils.extend(swiper, { 4548 observer: { 4549 init: Observer.init.bind(swiper), 4550 attach: Observer.attach.bind(swiper), 4551 destroy: Observer.destroy.bind(swiper), 4552 observers: [], 4553 }, 4554 }); 4555 }, 4556 on: { 4557 init: function init() { 4558 var swiper = this; 4559 swiper.observer.init(); 4560 }, 4561 destroy: function destroy() { 4562 var swiper = this; 4563 swiper.observer.destroy(); 4564 }, 4565 }, 4566 }; 4567 4568 var Virtual = { 4569 update: function update(force) { 4570 var swiper = this; 4571 var ref = swiper.params; 4572 var slidesPerView = ref.slidesPerView; 4573 var slidesPerGroup = ref.slidesPerGroup; 4574 var centeredSlides = ref.centeredSlides; 4575 var ref$1 = swiper.params.virtual; 4576 var addSlidesBefore = ref$1.addSlidesBefore; 4577 var addSlidesAfter = ref$1.addSlidesAfter; 4578 var ref$2 = swiper.virtual; 4579 var previousFrom = ref$2.from; 4580 var previousTo = ref$2.to; 4581 var slides = ref$2.slides; 4582 var previousSlidesGrid = ref$2.slidesGrid; 4583 var renderSlide = ref$2.renderSlide; 4584 var previousOffset = ref$2.offset; 4585 swiper.updateActiveIndex(); 4586 var activeIndex = swiper.activeIndex || 0; 4587 4588 var offsetProp; 4589 if (swiper.rtlTranslate) { offsetProp = 'right'; } 4590 else { offsetProp = swiper.isHorizontal() ? 'left' : 'top'; } 4591 4592 var slidesAfter; 4593 var slidesBefore; 4594 if (centeredSlides) { 4595 slidesAfter = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesBefore; 4596 slidesBefore = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesAfter; 4597 } else { 4598 slidesAfter = slidesPerView + (slidesPerGroup - 1) + addSlidesBefore; 4599 slidesBefore = slidesPerGroup + addSlidesAfter; 4600 } 4601 var from = Math.max((activeIndex || 0) - slidesBefore, 0); 4602 var to = Math.min((activeIndex || 0) + slidesAfter, slides.length - 1); 4603 var offset = (swiper.slidesGrid[from] || 0) - (swiper.slidesGrid[0] || 0); 4604 4605 Utils.extend(swiper.virtual, { 4606 from: from, 4607 to: to, 4608 offset: offset, 4609 slidesGrid: swiper.slidesGrid, 4610 }); 4611 4612 function onRendered() { 4613 swiper.updateSlides(); 4614 swiper.updateProgress(); 4615 swiper.updateSlidesClasses(); 4616 if (swiper.lazy && swiper.params.lazy.enabled) { 4617 swiper.lazy.load(); 4618 } 4619 } 4620 4621 if (previousFrom === from && previousTo === to && !force) { 4622 if (swiper.slidesGrid !== previousSlidesGrid && offset !== previousOffset) { 4623 swiper.slides.css(offsetProp, (offset + "px")); 4624 } 4625 swiper.updateProgress(); 4626 return; 4627 } 4628 if (swiper.params.virtual.renderExternal) { 4629 swiper.params.virtual.renderExternal.call(swiper, { 4630 offset: offset, 4631 from: from, 4632 to: to, 4633 slides: (function getSlides() { 4634 var slidesToRender = []; 4635 for (var i = from; i <= to; i += 1) { 4636 slidesToRender.push(slides[i]); 4637 } 4638 return slidesToRender; 4639 }()), 4640 }); 4641 onRendered(); 4642 return; 4643 } 4644 var prependIndexes = []; 4645 var appendIndexes = []; 4646 if (force) { 4647 swiper.$wrapperEl.find(("." + (swiper.params.slideClass))).remove(); 4648 } else { 4649 for (var i = previousFrom; i <= previousTo; i += 1) { 4650 if (i < from || i > to) { 4651 swiper.$wrapperEl.find(("." + (swiper.params.slideClass) + "[data-swiper-slide-index=\"" + i + "\"]")).remove(); 4652 } 4653 } 4654 } 4655 for (var i$1 = 0; i$1 < slides.length; i$1 += 1) { 4656 if (i$1 >= from && i$1 <= to) { 4657 if (typeof previousTo === 'undefined' || force) { 4658 appendIndexes.push(i$1); 4659 } else { 4660 if (i$1 > previousTo) { appendIndexes.push(i$1); } 4661 if (i$1 < previousFrom) { prependIndexes.push(i$1); } 4662 } 4663 } 4664 } 4665 appendIndexes.forEach(function (index) { 4666 swiper.$wrapperEl.append(renderSlide(slides[index], index)); 4667 }); 4668 prependIndexes.sort(function (a, b) { return b - a; }).forEach(function (index) { 4669 swiper.$wrapperEl.prepend(renderSlide(slides[index], index)); 4670 }); 4671 swiper.$wrapperEl.children('.swiper-slide').css(offsetProp, (offset + "px")); 4672 onRendered(); 4673 }, 4674 renderSlide: function renderSlide(slide, index) { 4675 var swiper = this; 4676 var params = swiper.params.virtual; 4677 if (params.cache && swiper.virtual.cache[index]) { 4678 return swiper.virtual.cache[index]; 4679 } 4680 var $slideEl = params.renderSlide 4681 ? $(params.renderSlide.call(swiper, slide, index)) 4682 : $(("<div class=\"" + (swiper.params.slideClass) + "\" data-swiper-slide-index=\"" + index + "\">" + slide + "</div>")); 4683 if (!$slideEl.attr('data-swiper-slide-index')) { $slideEl.attr('data-swiper-slide-index', index); } 4684 if (params.cache) { swiper.virtual.cache[index] = $slideEl; } 4685 return $slideEl; 4686 }, 4687 appendSlide: function appendSlide(slides) { 4688 var swiper = this; 4689 if (typeof slides === 'object' && 'length' in slides) { 4690 for (var i = 0; i < slides.length; i += 1) { 4691 if (slides[i]) { swiper.virtual.slides.push(slides[i]); } 4692 } 4693 } else { 4694 swiper.virtual.slides.push(slides); 4695 } 4696 swiper.virtual.update(true); 4697 }, 4698 prependSlide: function prependSlide(slides) { 4699 var swiper = this; 4700 var activeIndex = swiper.activeIndex; 4701 var newActiveIndex = activeIndex + 1; 4702 var numberOfNewSlides = 1; 4703 4704 if (Array.isArray(slides)) { 4705 for (var i = 0; i < slides.length; i += 1) { 4706 if (slides[i]) { swiper.virtual.slides.unshift(slides[i]); } 4707 } 4708 newActiveIndex = activeIndex + slides.length; 4709 numberOfNewSlides = slides.length; 4710 } else { 4711 swiper.virtual.slides.unshift(slides); 4712 } 4713 if (swiper.params.virtual.cache) { 4714 var cache = swiper.virtual.cache; 4715 var newCache = {}; 4716 Object.keys(cache).forEach(function (cachedIndex) { 4717
vendor: 10,266 bytes, lines 4717-5036
4717var $cachedEl = cache[cachedIndex]; 4718 var cachedElIndex = $cachedEl.attr('data-swiper-slide-index'); 4719 if (cachedElIndex) { 4720 $cachedEl.attr('data-swiper-slide-index', parseInt(cachedElIndex, 10) + 1); 4721 } 4722 newCache[parseInt(cachedIndex, 10) + numberOfNewSlides] = $cachedEl; 4723 }); 4724 swiper.virtual.cache = newCache; 4725 } 4726 swiper.virtual.update(true); 4727 swiper.slideTo(newActiveIndex, 0); 4728 }, 4729 removeSlide: function removeSlide(slidesIndexes) { 4730 var swiper = this; 4731 if (typeof slidesIndexes === 'undefined' || slidesIndexes === null) { return; } 4732 var activeIndex = swiper.activeIndex; 4733 if (Array.isArray(slidesIndexes)) { 4734 for (var i = slidesIndexes.length - 1; i >= 0; i -= 1) { 4735 swiper.virtual.slides.splice(slidesIndexes[i], 1); 4736 if (swiper.params.virtual.cache) { 4737 delete swiper.virtual.cache[slidesIndexes[i]]; 4738 } 4739 if (slidesIndexes[i] < activeIndex) { activeIndex -= 1; } 4740 activeIndex = Math.max(activeIndex, 0); 4741 } 4742 } else { 4743 swiper.virtual.slides.splice(slidesIndexes, 1); 4744 if (swiper.params.virtual.cache) { 4745 delete swiper.virtual.cache[slidesIndexes]; 4746 } 4747 if (slidesIndexes < activeIndex) { activeIndex -= 1; } 4748 activeIndex = Math.max(activeIndex, 0); 4749 } 4750 swiper.virtual.update(true); 4751 swiper.slideTo(activeIndex, 0); 4752 }, 4753 removeAllSlides: function removeAllSlides() { 4754 var swiper = this; 4755 swiper.virtual.slides = []; 4756 if (swiper.params.virtual.cache) { 4757 swiper.virtual.cache = {}; 4758 } 4759 swiper.virtual.update(true); 4760 swiper.slideTo(0, 0); 4761 }, 4762 }; 4763 4764 var Virtual$1 = { 4765 name: 'virtual', 4766 params: { 4767 virtual: { 4768 enabled: false, 4769 slides: [], 4770 cache: true, 4771 renderSlide: null, 4772 renderExternal: null, 4773 addSlidesBefore: 0, 4774 addSlidesAfter: 0, 4775 }, 4776 }, 4777 create: function create() { 4778 var swiper = this; 4779 Utils.extend(swiper, { 4780 virtual: { 4781 update: Virtual.update.bind(swiper), 4782 appendSlide: Virtual.appendSlide.bind(swiper), 4783 prependSlide: Virtual.prependSlide.bind(swiper), 4784 removeSlide: Virtual.removeSlide.bind(swiper), 4785 removeAllSlides: Virtual.removeAllSlides.bind(swiper), 4786 renderSlide: Virtual.renderSlide.bind(swiper), 4787 slides: swiper.params.virtual.slides, 4788 cache: {}, 4789 }, 4790 }); 4791 }, 4792 on: { 4793 beforeInit: function beforeInit() { 4794 var swiper = this; 4795 if (!swiper.params.virtual.enabled) { return; } 4796 swiper.classNames.push(((swiper.params.containerModifierClass) + "virtual")); 4797 var overwriteParams = { 4798 watchSlidesProgress: true, 4799 }; 4800 Utils.extend(swiper.params, overwriteParams); 4801 Utils.extend(swiper.originalParams, overwriteParams); 4802 4803 if (!swiper.params.initialSlide) { 4804 swiper.virtual.update(); 4805 } 4806 }, 4807 setTranslate: function setTranslate() { 4808 var swiper = this; 4809 if (!swiper.params.virtual.enabled) { return; } 4810 swiper.virtual.update(); 4811 }, 4812 }, 4813 }; 4814 4815 var Keyboard = { 4816 handle: function handle(event) { 4817 var swiper = this; 4818 var rtl = swiper.rtlTranslate; 4819 var e = event; 4820 if (e.originalEvent) { e = e.originalEvent; } // jquery fix 4821 var kc = e.keyCode || e.charCode; 4822 // Directions locks 4823 if (!swiper.allowSlideNext && ((swiper.isHorizontal() && kc === 39) || (swiper.isVertical() && kc === 40) || kc === 34)) { 4824 return false; 4825 } 4826 if (!swiper.allowSlidePrev && ((swiper.isHorizontal() && kc === 37) || (swiper.isVertical() && kc === 38) || kc === 33)) { 4827 return false; 4828 } 4829 if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) { 4830 return undefined; 4831 } 4832 if (doc.activeElement && doc.activeElement.nodeName && (doc.activeElement.nodeName.toLowerCase() === 'input' || doc.activeElement.nodeName.toLowerCase() === 'textarea')) { 4833 return undefined; 4834 } 4835 if (swiper.params.keyboard.onlyInViewport && (kc === 33 || kc === 34 || kc === 37 || kc === 39 || kc === 38 || kc === 40)) { 4836 var inView = false; 4837 // Check that swiper should be inside of visible area of window 4838 if (swiper.$el.parents(("." + (swiper.params.slideClass))).length > 0 && swiper.$el.parents(("." + (swiper.params.slideActiveClass))).length === 0) { 4839 return undefined; 4840 } 4841 var windowWidth = win.innerWidth; 4842 var windowHeight = win.innerHeight; 4843 var swiperOffset = swiper.$el.offset(); 4844 if (rtl) { swiperOffset.left -= swiper.$el[0].scrollLeft; } 4845 var swiperCoord = [ 4846 [swiperOffset.left, swiperOffset.top], 4847 [swiperOffset.left + swiper.width, swiperOffset.top], 4848 [swiperOffset.left, swiperOffset.top + swiper.height], 4849 [swiperOffset.left + swiper.width, swiperOffset.top + swiper.height] ]; 4850 for (var i = 0; i < swiperCoord.length; i += 1) { 4851 var point = swiperCoord[i]; 4852 if ( 4853 point[0] >= 0 && point[0] <= windowWidth 4854 && point[1] >= 0 && point[1] <= windowHeight 4855 ) { 4856 inView = true; 4857 } 4858 } 4859 if (!inView) { return undefined; } 4860 } 4861 if (swiper.isHorizontal()) { 4862 if (kc === 33 || kc === 34 || kc === 37 || kc === 39) { 4863 if (e.preventDefault) { e.preventDefault(); } 4864 else { e.returnValue = false; } 4865 } 4866 if (((kc === 34 || kc === 39) && !rtl) || ((kc === 33 || kc === 37) && rtl)) { swiper.slideNext(); } 4867 if (((kc === 33 || kc === 37) && !rtl) || ((kc === 34 || kc === 39) && rtl)) { swiper.slidePrev(); } 4868 } else { 4869 if (kc === 33 || kc === 34 || kc === 38 || kc === 40) { 4870 if (e.preventDefault) { e.preventDefault(); } 4871 else { e.returnValue = false; } 4872 } 4873 if (kc === 34 || kc === 40) { swiper.slideNext(); } 4874 if (kc === 33 || kc === 38) { swiper.slidePrev(); } 4875 } 4876 swiper.emit('keyPress', kc); 4877 return undefined; 4878 }, 4879 enable: function enable() { 4880 var swiper = this; 4881 if (swiper.keyboard.enabled) { return; } 4882 $(doc).on('keydown', swiper.keyboard.handle); 4883 swiper.keyboard.enabled = true; 4884 }, 4885 disable: function disable() { 4886 var swiper = this; 4887 if (!swiper.keyboard.enabled) { return; } 4888 $(doc).off('keydown', swiper.keyboard.handle); 4889 swiper.keyboard.enabled = false; 4890 }, 4891 }; 4892 4893 var Keyboard$1 = { 4894 name: 'keyboard', 4895 params: { 4896 keyboard: { 4897 enabled: false, 4898 onlyInViewport: true, 4899 }, 4900 }, 4901 create: function create() { 4902 var swiper = this; 4903 Utils.extend(swiper, { 4904 keyboard: { 4905 enabled: false, 4906 enable: Keyboard.enable.bind(swiper), 4907 disable: Keyboard.disable.bind(swiper), 4908 handle: Keyboard.handle.bind(swiper), 4909 }, 4910 }); 4911 }, 4912 on: { 4913 init: function init() { 4914 var swiper = this; 4915 if (swiper.params.keyboard.enabled) { 4916 swiper.keyboard.enable(); 4917 } 4918 }, 4919 destroy: function destroy() { 4920 var swiper = this; 4921 if (swiper.keyboard.enabled) { 4922 swiper.keyboard.disable(); 4923 } 4924 }, 4925 }, 4926 }; 4927 4928 function isEventSupported() { 4929 var eventName = 'onwheel'; 4930 var isSupported = eventName in doc; 4931 4932 if (!isSupported) { 4933 var element = doc.createElement('div'); 4934 element.setAttribute(eventName, 'return;'); 4935 isSupported = typeof element[eventName] === 'function'; 4936 } 4937 4938 if (!isSupported 4939 && doc.implementation 4940 && doc.implementation.hasFeature 4941 // always returns true in newer browsers as per the standard. 4942 // @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature 4943 && doc.implementation.hasFeature('', '') !== true 4944 ) { 4945 // This is the only way to test support for the `wheel` event in IE9+. 4946 isSupported = doc.implementation.hasFeature('Events.wheel', '3.0'); 4947 } 4948 4949 return isSupported; 4950 } 4951 var Mousewheel = { 4952 lastScrollTime: Utils.now(), 4953 lastEventBeforeSnap: undefined, 4954 recentWheelEvents: [], 4955 event: function event() { 4956 if (win.navigator.userAgent.indexOf('firefox') > -1) { return 'DOMMouseScroll'; } 4957 return isEventSupported() ? 'wheel' : 'mousewheel'; 4958 }, 4959 normalize: function normalize(e) { 4960 // Reasonable defaults 4961 var PIXEL_STEP = 10; 4962 var LINE_HEIGHT = 40; 4963 var PAGE_HEIGHT = 800; 4964 4965 var sX = 0; 4966 var sY = 0; // spinX, spinY 4967 var pX = 0; 4968 var pY = 0; // pixelX, pixelY 4969 4970 // Legacy 4971 if ('detail' in e) { 4972 sY = e.detail; 4973 } 4974 if ('wheelDelta' in e) { 4975 sY = -e.wheelDelta / 120; 4976 } 4977 if ('wheelDeltaY' in e) { 4978 sY = -e.wheelDeltaY / 120; 4979 } 4980 if ('wheelDeltaX' in e) { 4981 sX = -e.wheelDeltaX / 120; 4982 } 4983 4984 // side scrolling on FF with DOMMouseScroll 4985 if ('axis' in e && e.axis === e.HORIZONTAL_AXIS) { 4986 sX = sY; 4987 sY = 0; 4988 } 4989 4990 pX = sX * PIXEL_STEP; 4991 pY = sY * PIXEL_STEP; 4992 4993 if ('deltaY' in e) { 4994 pY = e.deltaY; 4995 } 4996 if ('deltaX' in e) { 4997 pX = e.deltaX; 4998 } 4999 5000 if (e.shiftKey && !pX) { // if user scrolls with shift he wants horizontal scroll 5001 pX = pY; 5002 pY = 0; 5003 } 5004 5005 if ((pX || pY) && e.deltaMode) { 5006 if (e.deltaMode === 1) { // delta in LINE units 5007 pX *= LINE_HEIGHT; 5008 pY *= LINE_HEIGHT; 5009 } else { // delta in PAGE units 5010 pX *= PAGE_HEIGHT; 5011 pY *= PAGE_HEIGHT; 5012 } 5013 } 5014 5015 // Fall-back if spin cannot be determined 5016 if (pX && !sX) { 5017 sX = (pX < 1) ? -1 : 1; 5018 } 5019 if (pY && !sY) { 5020 sY = (pY < 1) ? -1 : 1; 5021 } 5022 5023 return { 5024 spinX: sX, 5025 spinY: sY, 5026 pixelX: pX, 5027 pixelY: pY, 5028 }; 5029 }, 5030 handleMouseEnter: function handleMouseEnter() { 5031 var swiper = this; 5032 swiper.mouseEntered = true; 5033 }, 5034 handleMouseLeave: function handleMouseLeave() { 5035 var swiper = this; 5036 swiper.mouseEntered = false;
5037 }, 5038 handle: function handle(event) { 5039 var e = event; 5040 var swiper = this; 5041 var params = swiper.params.mousewheel; 5042 5043 if (swiper.params.cssMode) { 5044 e.preventDefault(); 5045 } 5046 5047 if (!swiper.mouseEntered && !params.releaseOnEdges) { return true; } 5048 5049 if (e.originalEvent) { e = e.originalEvent; } // jquery fix 5050 var delta = 0; 5051 var rtlFactor = swiper.rtlTranslate ? -1 : 1; 5052 5053 var data = Mousewheel.normalize(e); 5054 5055 if (params.forceToAxis) { 5056 if (swiper.isHorizontal()) { 5057 if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) { delta = data.pixelX * rtlFactor; } 5058 else { return true; } 5059 } else if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) { delta = data.pixelY; } 5060 else { return true; } 5061 } else { 5062 delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY; 5063 } 5064 5065 if (delta === 0) { return true; } 5066 5067 if (params.invert) { delta = -delta; } 5068 5069 if (!swiper.params.freeMode) { 5070 // Register the new event in a variable which stores the relevant data 5071 var newEvent = { 5072 time: Utils.now(), 5073 delta: Math.abs(delta), 5074 direction: Math.sign(delta), 5075 raw: event, 5076 }; 5077 5078 // Keep the most recent events 5079 var recentWheelEvents = swiper.mousewheel.recentWheelEvents; 5080 if (recentWheelEvents.length >= 2) { 5081 recentWheelEvents.shift(); // only store the last N events 5082 } 5083 var prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; 5084 recentWheelEvents.push(newEvent); 5085 5086 // If there is at least one previous recorded event: 5087 // If direction has changed or 5088 // if the scroll is quicker than the previous one: 5089 // Animate the slider. 5090 // Else (this is the first time the wheel is moved): 5091 // Animate the slider. 5092 if (prevEvent) { 5093 if (newEvent.direction !== prevEvent.direction || newEvent.delta > prevEvent.delta) { 5094 swiper.mousewheel.animateSlider(newEvent); 5095 } 5096 } else { 5097 swiper.mousewheel.animateSlider(newEvent); 5098 } 5099 5100 // If it's time to release the scroll: 5101 // Return now so you don't hit the preventDefault. 5102 if (swiper.mousewheel.releaseScroll(newEvent)) { 5103 return true; 5104 } 5105 } else { 5106 // Freemode or scrollContainer: 5107 5108 // If we recently snapped after a momentum scroll, then ignore wheel events 5109 // to give time for the deceleration to finish. Stop ignoring after 500 msecs 5110 // or if it's a new scroll (larger delta or inverse sign as last event before 5111 // an end-of-momentum snap). 5112 var newEvent$1 = { time: Utils.now(), delta: Math.abs(delta), direction: Math.sign(delta) }; 5113 var ref = swiper.mousewheel; 5114 var lastEventBeforeSnap = ref.lastEventBeforeSnap; 5115 var ignoreWheelEvents = lastEventBeforeSnap 5116 && newEvent$1.time < lastEventBeforeSnap.time + 500 5117 && newEvent$1.delta <= lastEventBeforeSnap.delta 5118 && newEvent$1.direction === lastEventBeforeSnap.direction; 5119 if (!ignoreWheelEvents) { 5120 swiper.mousewheel.lastEventBeforeSnap = undefined; 5121 5122 if (swiper.params.loop) { 5123 swiper.loopFix(); 5124 } 5125 var position = swiper.getTranslate() + (delta * params.sensitivity); 5126 var wasBeginning = swiper.isBeginning; 5127 var wasEnd = swiper.isEnd; 5128 5129 if (position >= swiper.minTranslate()) { position = swiper.minTranslate(); } 5130 if (position <= swiper.maxTranslate()) { position = swiper.maxTranslate(); } 5131 5132 swiper.setTransition(0); 5133 swiper.setTranslate(position); 5134 swiper.updateProgress(); 5135 swiper.updateActiveIndex(); 5136 swiper.updateSlidesClasses(); 5137 5138 if ((!wasBeginning && swiper.isBeginning) || (!wasEnd && swiper.isEnd)) { 5139 swiper.updateSlidesClasses(); 5140 } 5141 5142 if (swiper.params.freeModeSticky) { 5143 // When wheel scrolling starts with sticky (aka snap) enabled, then detect 5144 // the end of a momentum scroll by storing recent (N=15?) wheel events.
5145 // 1. do all N events have decreasing or same (absolute value) delta? 5146 // 2. did all N events arrive in the last M (M=500?) msecs? 5147 // 3. does the earliest event have an (absolute value) delta that's 5148 // at least P (P=1?) larger than the most recent event's delta? 5149 // 4. does the latest event have a delta that's smaller than Q (Q=6?) pixels? 5150 // If 1-4 are "yes" then we're near the end of a momuntum scroll deceleration. 5151 // Snap immediately and ignore remaining wheel events in this scroll. 5152 // See comment above for "remaining wheel events in this scroll" determination. 5153 // If 1-4 aren't satisfied, then wait to snap until 500ms after the last event. 5154 clearTimeout(swiper.mousewheel.timeout); 5155 swiper.mousewheel.timeout = undefined; 5156 var recentWheelEvents$1 = swiper.mousewheel.recentWheelEvents; 5157 if (recentWheelEvents$1.length >= 15) { 5158 recentWheelEvents$1.shift(); // only store the last N events 5159 } 5160 var prevEvent$1 = recentWheelEvents$1.length ? recentWheelEvents$1[recentWheelEvents$1.length - 1] : undefined; 5161 var firstEvent = recentWheelEvents$1[0]; 5162 recentWheelEvents$1.push(newEvent$1); 5163 if (prevEvent$1 && (newEvent$1.delta > prevEvent$1.delta || newEvent$1.direction !== prevEvent$1.direction)) { 5164 // Increasing or reverse-sign delta means the user started scrolling again. Clear the wheel event log. 5165 recentWheelEvents$1.splice(0); 5166 } else if (recentWheelEvents$1.length >= 15 5167 && newEvent$1.time - firstEvent.time < 500 5168 && firstEvent.delta - newEvent$1.delta >= 1 5169 && newEvent$1.delta <= 6 5170 ) { 5171 // We're at the end of the deceleration of a momentum scroll, so there's no need 5172 // to wait for more events. Snap ASAP on the next tick. 5173 // Also, because there's some remaining momentum we'll bias the snap in the 5174 // direction of the ongoing scroll because it's better UX for the scroll to snap 5175 // in the same direction as the scroll instead of reversing to snap. Therefore, 5176 // if it's already scrolled more than 20% in the current direction, keep going. 5177 var snapToThreshold = delta > 0 ? 0.8 : 0.2; 5178 swiper.mousewheel.lastEventBeforeSnap = newEvent$1; 5179 recentWheelEvents$1.splice(0); 5180 swiper.mousewheel.timeout = Utils.nextTick(function () { 5181 swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); 5182 }, 0); // no delay; move on next tick 5183 } 5184 if (!swiper.mousewheel.timeout) { 5185 // if we get here, then we haven't detected the end of a momentum scroll, so 5186 // we'll consider a scroll "complete" when there haven't been any wheel events 5187 // for 500ms. 5188 swiper.mousewheel.timeout = Utils.nextTick(function () { 5189 var snapToThreshold = 0.5; 5190 swiper.mousewheel.lastEventBeforeSnap = newEvent$1; 5191 recentWheelEvents$1.splice(0); 5192 swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); 5193 }, 500); 5194 } 5195 } 5196 5197 // Emit event 5198 if (!ignoreWheelEvents) { swiper.emit('scroll', e); } 5199 5200 // Stop autoplay 5201 if (swiper.params.autoplay && swiper.params.autoplayDisableOnInteraction) { swiper.autoplay.stop(); } 5202 // Return page scroll on edge positions 5203 if (position === swiper.minTranslate() || position === swiper.maxTranslate()) { return true; } 5204 } 5205 } 5206 5207 if (e.preventDefault) { e.preventDefault(); } 5208 else { e.returnValue = false; } 5209 return false; 5210 }, 5211 animateSlider: function animateSlider(newEvent) { 5212 var swiper = this; 5213 // If the movement is NOT big enough and 5214 // if the last time the user scrolled was too close to the current one (avoid continuously triggering the slider): 5215 // Don't go any further (avoid insignificant scroll movement). 5216 if (newEvent.delta >= 6 && Utils.now() - swiper.mousewheel.lastScrollTime < 60) { 5217 // Return false as a default 5218 return true; 5219 } 5220 // If user is scrolling towards the end: 5221 // If the slider hasn't hit the latest slide or 5222 // if the slider is a loop and 5223 // if the slider isn't moving right now: 5224 // Go to next slide and 5225 // emit a scroll event. 5226 // Else (the user is scrolling towards the beginning) and 5227 // if the slider hasn't hit the first slide or 5228 // if the slider is a loop and 5229 // if the slider isn't moving right now: 5230 // Go to prev slide and 5231 // emit a scroll event. 5232 if (newEvent.direction < 0) { 5233 if ((!swiper.isEnd || swiper.params.loop) && !swiper.animating) { 5234 swiper.slideNext(); 5235 swiper.emit('scroll', newEvent.raw); 5236 } 5237 } else if ((!swiper.isBeginning || swiper.params.loop) && !swiper.animating) { 5238 swiper.slidePrev(); 5239 swiper.emit('scroll', newEvent.raw); 5240 } 5241 // If you got here is because an animation has been triggered so store the current time 5242 swiper.mousewheel.lastScrollTime = (new win.Date()).getTime(); 5243 // Return false as a default 5244 return false;
5245 }, 5246 releaseScroll: function releaseScroll(newEvent) { 5247 var swiper = this; 5248 var params = swiper.params.mousewheel; 5249 if (newEvent.direction < 0) { 5250 if (swiper.isEnd && !swiper.params.loop && params.releaseOnEdges) { 5251 // Return true to animate scroll on edges 5252 return true; 5253 } 5254 } else if (swiper.isBeginning && !swiper.params.loop && params.releaseOnEdges) { 5255 // Return true to animate scroll on edges 5256 return true; 5257 } 5258 return false; 5259 }, 5260 enable: function enable() { 5261 var swiper = this; 5262 var event = Mousewheel.event(); 5263 if (swiper.params.cssMode) { 5264 swiper.wrapperEl.removeEventListener(event, swiper.mousewheel.handle); 5265 return true; 5266 } 5267 if (!event) { return false; } 5268 if (swiper.mousewheel.enabled) { return false; } 5269 var target = swiper.$el; 5270 if (swiper.params.mousewheel.eventsTarged !== 'container') { 5271 target = $(swiper.params.mousewheel.eventsTarged); 5272 } 5273 target.on('mouseenter', swiper.mousewheel.handleMouseEnter); 5274 target.on('mouseleave', swiper.mousewheel.handleMouseLeave); 5275 target.on(event, swiper.mousewheel.handle); 5276 swiper.mousewheel.enabled = true; 5277 return true; 5278 }, 5279 disable: function disable() { 5280 var swiper = this; 5281 var event = Mousewheel.event(); 5282 if (swiper.params.cssMode) { 5283 swiper.wrapperEl.addEventListener(event, swiper.mousewheel.handle); 5284 return true; 5285 } 5286 if (!event) { return false; } 5287 if (!swiper.mousewheel.enabled) { return false; } 5288 var target = swiper.$el; 5289 if (swiper.params.mousewheel.eventsTarged !== 'container') { 5290 target = $(swiper.params.mousewheel.eventsTarged); 5291 } 5292 target.off(event, swiper.mousewheel.handle); 5293 swiper.mousewheel.enabled = false; 5294 return true; 5295 }, 5296 }; 5297 5298 var Mousewheel$1 = { 5299 name: 'mousewheel', 5300 params: { 5301 mousewheel: { 5302 enabled: false, 5303 releaseOnEdges: false, 5304 invert: false,
vendor: 12,407 bytes, lines 5305-5633
5305 forceToAxis: false, 5306 sensitivity: 1, 5307 eventsTarged: 'container', 5308 }, 5309 }, 5310 create: function create() { 5311 var swiper = this; 5312 Utils.extend(swiper, { 5313 mousewheel: { 5314 enabled: false, 5315 enable: Mousewheel.enable.bind(swiper), 5316 disable: Mousewheel.disable.bind(swiper), 5317 handle: Mousewheel.handle.bind(swiper), 5318 handleMouseEnter: Mousewheel.handleMouseEnter.bind(swiper), 5319 handleMouseLeave: Mousewheel.handleMouseLeave.bind(swiper), 5320 animateSlider: Mousewheel.animateSlider.bind(swiper), 5321 releaseScroll: Mousewheel.releaseScroll.bind(swiper), 5322 lastScrollTime: Utils.now(), 5323 lastEventBeforeSnap: undefined, 5324 recentWheelEvents: [], 5325 }, 5326 }); 5327 }, 5328 on: { 5329 init: function init() { 5330 var swiper = this; 5331 if (!swiper.params.mousewheel.enabled && swiper.params.cssMode) { 5332 swiper.mousewheel.disable(); 5333 } 5334 if (swiper.params.mousewheel.enabled) { swiper.mousewheel.enable(); } 5335 }, 5336 destroy: function destroy() { 5337 var swiper = this; 5338 if (swiper.params.cssMode) { 5339 swiper.mousewheel.enable(); 5340 } 5341 if (swiper.mousewheel.enabled) { swiper.mousewheel.disable(); } 5342 }, 5343 }, 5344 }; 5345 5346 var Navigation = { 5347 update: function update() { 5348 // Update Navigation Buttons 5349 var swiper = this; 5350 var params = swiper.params.navigation; 5351 5352 if (swiper.params.loop) { return; } 5353 var ref = swiper.navigation; 5354 var $nextEl = ref.$nextEl; 5355 var $prevEl = ref.$prevEl; 5356 5357 if ($prevEl && $prevEl.length > 0) { 5358 if (swiper.isBeginning) { 5359 $prevEl.addClass(params.disabledClass); 5360 } else { 5361 $prevEl.removeClass(params.disabledClass); 5362 } 5363 $prevEl[swiper.params.watchOverflow && swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass); 5364 } 5365 if ($nextEl && $nextEl.length > 0) { 5366 if (swiper.isEnd) { 5367 $nextEl.addClass(params.disabledClass); 5368 } else { 5369 $nextEl.removeClass(params.disabledClass); 5370 } 5371 $nextEl[swiper.params.watchOverflow && swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass); 5372 } 5373 }, 5374 onPrevClick: function onPrevClick(e) { 5375 var swiper = this; 5376 e.preventDefault(); 5377 if (swiper.isBeginning && !swiper.params.loop) { return; } 5378 swiper.slidePrev(); 5379 }, 5380 onNextClick: function onNextClick(e) { 5381 var swiper = this; 5382 e.preventDefault(); 5383 if (swiper.isEnd && !swiper.params.loop) { return; } 5384 swiper.slideNext(); 5385 }, 5386 init: function init() { 5387 var swiper = this; 5388 var params = swiper.params.navigation; 5389 if (!(params.nextEl || params.prevEl)) { return; } 5390 5391 var $nextEl; 5392 var $prevEl; 5393 if (params.nextEl) { 5394 $nextEl = $(params.nextEl); 5395 if ( 5396 swiper.params.uniqueNavElements 5397 && typeof params.nextEl === 'string' 5398 && $nextEl.length > 1 5399 && swiper.$el.find(params.nextEl).length === 1 5400 ) { 5401 $nextEl = swiper.$el.find(params.nextEl); 5402 } 5403 } 5404 if (params.prevEl) { 5405 $prevEl = $(params.prevEl); 5406 if ( 5407 swiper.params.uniqueNavElements 5408 && typeof params.prevEl === 'string' 5409 && $prevEl.length > 1 5410 && swiper.$el.find(params.prevEl).length === 1 5411 ) { 5412 $prevEl = swiper.$el.find(params.prevEl); 5413 } 5414 } 5415 5416 if ($nextEl && $nextEl.length > 0) { 5417 $nextEl.on('click', swiper.navigation.onNextClick); 5418 } 5419 if ($prevEl && $prevEl.length > 0) { 5420 $prevEl.on('click', swiper.navigation.onPrevClick); 5421 } 5422 5423 Utils.extend(swiper.navigation, { 5424 $nextEl: $nextEl, 5425 nextEl: $nextEl && $nextEl[0], 5426 $prevEl: $prevEl, 5427 prevEl: $prevEl && $prevEl[0], 5428 }); 5429 }, 5430 destroy: function destroy() { 5431 var swiper = this; 5432 var ref = swiper.navigation; 5433 var $nextEl = ref.$nextEl; 5434 var $prevEl = ref.$prevEl; 5435 if ($nextEl && $nextEl.length) { 5436 $nextEl.off('click', swiper.navigation.onNextClick); 5437 $nextEl.removeClass(swiper.params.navigation.disabledClass); 5438 } 5439 if ($prevEl && $prevEl.length) { 5440 $prevEl.off('click', swiper.navigation.onPrevClick); 5441 $prevEl.removeClass(swiper.params.navigation.disabledClass); 5442 } 5443 }, 5444 }; 5445 5446 var Navigation$1 = { 5447 name: 'navigation', 5448 params: { 5449 navigation: { 5450 nextEl: null, 5451 prevEl: null, 5452 5453 hideOnClick: false, 5454 disabledClass: 'swiper-button-disabled', 5455 hiddenClass: 'swiper-button-hidden', 5456 lockClass: 'swiper-button-lock', 5457 }, 5458 }, 5459 create: function create() { 5460 var swiper = this; 5461 Utils.extend(swiper, { 5462 navigation: { 5463 init: Navigation.init.bind(swiper), 5464 update: Navigation.update.bind(swiper), 5465 destroy: Navigation.destroy.bind(swiper), 5466 onNextClick: Navigation.onNextClick.bind(swiper), 5467 onPrevClick: Navigation.onPrevClick.bind(swiper), 5468 }, 5469 }); 5470 }, 5471 on: { 5472 init: function init() { 5473 var swiper = this; 5474 swiper.navigation.init(); 5475 swiper.navigation.update(); 5476 }, 5477 toEdge: function toEdge() { 5478 var swiper = this; 5479 swiper.navigation.update(); 5480 }, 5481 fromEdge: function fromEdge() { 5482 var swiper = this; 5483 swiper.navigation.update(); 5484 }, 5485 destroy: function destroy() { 5486 var swiper = this; 5487 swiper.navigation.destroy(); 5488 }, 5489 click: function click(e) { 5490 var swiper = this; 5491 var ref = swiper.navigation; 5492 var $nextEl = ref.$nextEl; 5493 var $prevEl = ref.$prevEl; 5494 if ( 5495 swiper.params.navigation.hideOnClick 5496 && !$(e.target).is($prevEl) 5497 && !$(e.target).is($nextEl) 5498 ) { 5499 var isHidden; 5500 if ($nextEl) { 5501 isHidden = $nextEl.hasClass(swiper.params.navigation.hiddenClass); 5502 } else if ($prevEl) { 5503 isHidden = $prevEl.hasClass(swiper.params.navigation.hiddenClass); 5504 } 5505 if (isHidden === true) { 5506 swiper.emit('navigationShow', swiper); 5507 } else { 5508 swiper.emit('navigationHide', swiper); 5509 } 5510 if ($nextEl) { 5511 $nextEl.toggleClass(swiper.params.navigation.hiddenClass); 5512 } 5513 if ($prevEl) { 5514 $prevEl.toggleClass(swiper.params.navigation.hiddenClass); 5515 } 5516 } 5517 }, 5518 }, 5519 }; 5520 5521 var Pagination = { 5522 update: function update() { 5523 // Render || Update Pagination bullets/items 5524 var swiper = this; 5525 var rtl = swiper.rtl; 5526 var params = swiper.params.pagination; 5527 if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) { return; } 5528 var slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length; 5529 var $el = swiper.pagination.$el; 5530 // Current/Total 5531 var current; 5532 var total = swiper.params.loop ? Math.ceil((slidesLength - (swiper.loopedSlides * 2)) / swiper.params.slidesPerGroup) : swiper.snapGrid.length; 5533 if (swiper.params.loop) { 5534 current = Math.ceil((swiper.activeIndex - swiper.loopedSlides) / swiper.params.slidesPerGroup); 5535 if (current > slidesLength - 1 - (swiper.loopedSlides * 2)) { 5536 current -= (slidesLength - (swiper.loopedSlides * 2)); 5537 } 5538 if (current > total - 1) { current -= total; } 5539 if (current < 0 && swiper.params.paginationType !== 'bullets') { current = total + current; } 5540 } else if (typeof swiper.snapIndex !== 'undefined') { 5541 current = swiper.snapIndex; 5542 } else { 5543 current = swiper.activeIndex || 0; 5544 } 5545 // Types 5546 if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) { 5547 var bullets = swiper.pagination.bullets; 5548 var firstIndex; 5549 var lastIndex; 5550 var midIndex; 5551 if (params.dynamicBullets) { 5552 swiper.pagination.bulletSize = bullets.eq(0)[swiper.isHorizontal() ? 'outerWidth' : 'outerHeight'](true); 5553 $el.css(swiper.isHorizontal() ? 'width' : 'height', ((swiper.pagination.bulletSize * (params.dynamicMainBullets + 4)) + "px")); 5554 if (params.dynamicMainBullets > 1 && swiper.previousIndex !== undefined) { 5555 swiper.pagination.dynamicBulletIndex += (current - swiper.previousIndex); 5556 if (swiper.pagination.dynamicBulletIndex > (params.dynamicMainBullets - 1)) { 5557 swiper.pagination.dynamicBulletIndex = params.dynamicMainBullets - 1; 5558 } else if (swiper.pagination.dynamicBulletIndex < 0) { 5559 swiper.pagination.dynamicBulletIndex = 0; 5560 } 5561 } 5562 firstIndex = current - swiper.pagination.dynamicBulletIndex; 5563 lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1); 5564 midIndex = (lastIndex + firstIndex) / 2; 5565 } 5566 bullets.removeClass(((params.bulletActiveClass) + " " + (params.bulletActiveClass) + "-next " + (params.bulletActiveClass) + "-next-next " + (params.bulletActiveClass) + "-prev " + (params.bulletActiveClass) + "-prev-prev " + (params.bulletActiveClass) + "-main")); 5567 if ($el.length > 1) { 5568 bullets.each(function (index, bullet) { 5569 var $bullet = $(bullet); 5570 var bulletIndex = $bullet.index(); 5571 if (bulletIndex === current) { 5572 $bullet.addClass(params.bulletActiveClass); 5573 } 5574 if (params.dynamicBullets) { 5575 if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) { 5576 $bullet.addClass(((params.bulletActiveClass) + "-main")); 5577 } 5578 if (bulletIndex === firstIndex) { 5579 $bullet 5580 .prev() 5581 .addClass(((params.bulletActiveClass) + "-prev")) 5582 .prev() 5583 .addClass(((params.bulletActiveClass) + "-prev-prev")); 5584 } 5585 if (bulletIndex === lastIndex) { 5586 $bullet 5587 .next() 5588 .addClass(((params.bulletActiveClass) + "-next")) 5589 .next() 5590 .addClass(((params.bulletActiveClass) + "-next-next")); 5591 } 5592 } 5593 }); 5594 } else { 5595 var $bullet = bullets.eq(current); 5596 var bulletIndex = $bullet.index(); 5597 $bullet.addClass(params.bulletActiveClass); 5598 if (params.dynamicBullets) { 5599 var $firstDisplayedBullet = bullets.eq(firstIndex); 5600 var $lastDisplayedBullet = bullets.eq(lastIndex); 5601 for (var i = firstIndex; i <= lastIndex; i += 1) { 5602 bullets.eq(i).addClass(((params.bulletActiveClass) + "-main")); 5603 } 5604 if (swiper.params.loop) { 5605 if (bulletIndex >= bullets.length - params.dynamicMainBullets) { 5606 for (var i$1 = params.dynamicMainBullets; i$1 >= 0; i$1 -= 1) { 5607 bullets.eq(bullets.length - i$1).addClass(((params.bulletActiveClass) + "-main")); 5608 } 5609 bullets.eq(bullets.length - params.dynamicMainBullets - 1).addClass(((params.bulletActiveClass) + "-prev")); 5610 } else { 5611 $firstDisplayedBullet 5612 .prev() 5613 .addClass(((params.bulletActiveClass) + "-prev")) 5614 .prev() 5615 .addClass(((params.bulletActiveClass) + "-prev-prev")); 5616 $lastDisplayedBullet 5617 .next() 5618 .addClass(((params.bulletActiveClass) + "-next")) 5619 .next() 5620 .addClass(((params.bulletActiveClass) + "-next-next")); 5621 } 5622 } else { 5623 $firstDisplayedBullet 5624 .prev() 5625 .addClass(((params.bulletActiveClass) + "-prev")) 5626 .prev() 5627 .addClass(((params.bulletActiveClass) + "-prev-prev")); 5628 $lastDisplayedBullet 5629 .next() 5630 .addClass(((params.bulletActiveClass) + "-next")) 5631 .next() 5632 .addClass(((params.bulletActiveClass) + "-next-next")); 5633 }
vendor: 10,280 bytes, lines 5633-5909
5633 5634 } 5635 } 5636 if (params.dynamicBullets) { 5637 var dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4); 5638 var bulletsOffset = (((swiper.pagination.bulletSize * dynamicBulletsLength) - (swiper.pagination.bulletSize)) / 2) - (midIndex * swiper.pagination.bulletSize); 5639 var offsetProp = rtl ? 'right' : 'left'; 5640 bullets.css(swiper.isHorizontal() ? offsetProp : 'top', (bulletsOffset + "px")); 5641 } 5642 } 5643 if (params.type === 'fraction') { 5644 $el.find(("." + (params.currentClass))).text(params.formatFractionCurrent(current + 1)); 5645 $el.find(("." + (params.totalClass))).text(params.formatFractionTotal(total)); 5646 } 5647 if (params.type === 'progressbar') { 5648 var progressbarDirection; 5649 if (params.progressbarOpposite) { 5650 progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal'; 5651 } else { 5652 progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical'; 5653 } 5654 var scale = (current + 1) / total; 5655 var scaleX = 1; 5656 var scaleY = 1; 5657 if (progressbarDirection === 'horizontal') { 5658 scaleX = scale; 5659 } else { 5660 scaleY = scale; 5661 } 5662 $el.find(("." + (params.progressbarFillClass))).transform(("translate3d(0,0,0) scaleX(" + scaleX + ") scaleY(" + scaleY + ")")).transition(swiper.params.speed); 5663 } 5664 if (params.type === 'custom' && params.renderCustom) { 5665 $el.html(params.renderCustom(swiper, current + 1, total)); 5666 swiper.emit('paginationRender', swiper, $el[0]); 5667 } else { 5668 swiper.emit('paginationUpdate', swiper, $el[0]); 5669 } 5670 $el[swiper.params.watchOverflow && swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass); 5671 }, 5672 render: function render() { 5673 // Render Container 5674 var swiper = this; 5675 var params = swiper.params.pagination; 5676 if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) { return; } 5677 var slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length; 5678 5679 var $el = swiper.pagination.$el; 5680 var paginationHTML = ''; 5681 if (params.type === 'bullets') { 5682 var numberOfBullets = swiper.params.loop ? Math.ceil((slidesLength - (swiper.loopedSlides * 2)) / swiper.params.slidesPerGroup) : swiper.snapGrid.length; 5683 for (var i = 0; i < numberOfBullets; i += 1) { 5684 if (params.renderBullet) { 5685 paginationHTML += params.renderBullet.call(swiper, i, params.bulletClass); 5686 } else { 5687 paginationHTML += "<" + (params.bulletElement) + " class=\"" + (params.bulletClass) + "\"></" + (params.bulletElement) + ">"; 5688 } 5689 } 5690 $el.html(paginationHTML); 5691 swiper.pagination.bullets = $el.find(("." + (params.bulletClass))); 5692 } 5693 if (params.type === 'fraction') { 5694 if (params.renderFraction) { 5695 paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass); 5696 } else { 5697 paginationHTML = "<span class=\"" + (params.currentClass) + "\"></span>" 5698 + ' / ' 5699 + "<span class=\"" + (params.totalClass) + "\"></span>"; 5700 } 5701 $el.html(paginationHTML); 5702 } 5703 if (params.type === 'progressbar') { 5704 if (params.renderProgressbar) { 5705 paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass); 5706 } else { 5707 paginationHTML = "<span class=\"" + (params.progressbarFillClass) + "\"></span>"; 5708 } 5709 $el.html(paginationHTML); 5710 } 5711 if (params.type !== 'custom') { 5712 swiper.emit('paginationRender', swiper.pagination.$el[0]); 5713 } 5714 }, 5715 init: function init() { 5716 var swiper = this; 5717 var params = swiper.params.pagination; 5718 if (!params.el) { return; } 5719 5720 var $el = $(params.el); 5721 if ($el.length === 0) { return; } 5722 5723 if ( 5724 swiper.params.uniqueNavElements 5725 && typeof params.el === 'string' 5726 && $el.length > 1 5727 && swiper.$el.find(params.el).length === 1 5728 ) { 5729 $el = swiper.$el.find(params.el); 5730 } 5731 5732 if (params.type === 'bullets' && params.clickable) { 5733 $el.addClass(params.clickableClass); 5734 } 5735 5736 $el.addClass(params.modifierClass + params.type); 5737 5738 if (params.type === 'bullets' && params.dynamicBullets) { 5739 $el.addClass(("" + (params.modifierClass) + (params.type) + "-dynamic")); 5740 swiper.pagination.dynamicBulletIndex = 0; 5741 if (params.dynamicMainBullets < 1) { 5742 params.dynamicMainBullets = 1; 5743 } 5744 } 5745 if (params.type === 'progressbar' && params.progressbarOpposite) { 5746 $el.addClass(params.progressbarOppositeClass); 5747 } 5748 5749 if (params.clickable) { 5750 $el.on('click', ("." + (params.bulletClass)), function onClick(e) { 5751 e.preventDefault(); 5752 var index = $(this).index() * swiper.params.slidesPerGroup; 5753 if (swiper.params.loop) { index += swiper.loopedSlides; } 5754 swiper.slideTo(index); 5755 }); 5756 } 5757 5758 Utils.extend(swiper.pagination, { 5759 $el: $el, 5760 el: $el[0], 5761 }); 5762 }, 5763 destroy: function destroy() { 5764 var swiper = this; 5765 var params = swiper.params.pagination; 5766 if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) { return; } 5767 var $el = swiper.pagination.$el; 5768 5769 $el.removeClass(params.hiddenClass); 5770 $el.removeClass(params.modifierClass + params.type); 5771 if (swiper.pagination.bullets) { swiper.pagination.bullets.removeClass(params.bulletActiveClass); } 5772 if (params.clickable) { 5773 $el.off('click', ("." + (params.bulletClass))); 5774 } 5775 }, 5776 }; 5777 5778 var Pagination$1 = { 5779 name: 'pagination', 5780 params: { 5781 pagination: { 5782 el: null, 5783 bulletElement: 'span', 5784 clickable: false, 5785 hideOnClick: false, 5786 renderBullet: null, 5787 renderProgressbar: null, 5788 renderFraction: null, 5789 renderCustom: null, 5790 progressbarOpposite: false, 5791 type: 'bullets', // 'bullets' or 'progressbar' or 'fraction' or 'custom' 5792 dynamicBullets: false, 5793 dynamicMainBullets: 1, 5794 formatFractionCurrent: function (number) { return number; }, 5795 formatFractionTotal: function (number) { return number; }, 5796 bulletClass: 'swiper-pagination-bullet', 5797 bulletActiveClass: 'swiper-pagination-bullet-active', 5798 modifierClass: 'swiper-pagination-', // NEW 5799 currentClass: 'swiper-pagination-current', 5800 totalClass: 'swiper-pagination-total', 5801 hiddenClass: 'swiper-pagination-hidden', 5802 progressbarFillClass: 'swiper-pagination-progressbar-fill', 5803 progressbarOppositeClass: 'swiper-pagination-progressbar-opposite', 5804 clickableClass: 'swiper-pagination-clickable', // NEW 5805 lockClass: 'swiper-pagination-lock', 5806 }, 5807 }, 5808 create: function create() { 5809 var swiper = this; 5810 Utils.extend(swiper, { 5811 pagination: { 5812 init: Pagination.init.bind(swiper), 5813 render: Pagination.render.bind(swiper), 5814 update: Pagination.update.bind(swiper), 5815 destroy: Pagination.destroy.bind(swiper), 5816 dynamicBulletIndex: 0, 5817 }, 5818 }); 5819 }, 5820 on: { 5821 init: function init() { 5822 var swiper = this; 5823 swiper.pagination.init(); 5824 swiper.pagination.render(); 5825 swiper.pagination.update(); 5826 }, 5827 activeIndexChange: function activeIndexChange() { 5828 var swiper = this; 5829 if (swiper.params.loop) { 5830 swiper.pagination.update(); 5831 } else if (typeof swiper.snapIndex === 'undefined') { 5832 swiper.pagination.update(); 5833 } 5834 }, 5835 snapIndexChange: function snapIndexChange() { 5836 var swiper = this; 5837 if (!swiper.params.loop) { 5838 swiper.pagination.update(); 5839 } 5840 }, 5841 slidesLengthChange: function slidesLengthChange() { 5842 var swiper = this; 5843 if (swiper.params.loop) { 5844 swiper.pagination.render(); 5845 swiper.pagination.update(); 5846 } 5847 }, 5848 snapGridLengthChange: function snapGridLengthChange() { 5849 var swiper = this; 5850 if (!swiper.params.loop) { 5851 swiper.pagination.render(); 5852 swiper.pagination.update(); 5853 } 5854 }, 5855 destroy: function destroy() { 5856 var swiper = this; 5857 swiper.pagination.destroy(); 5858 }, 5859 click: function click(e) { 5860 var swiper = this; 5861 if ( 5862 swiper.params.pagination.el 5863 && swiper.params.pagination.hideOnClick 5864 && swiper.pagination.$el.length > 0 5865 && !$(e.target).hasClass(swiper.params.pagination.bulletClass) 5866 ) { 5867 var isHidden = swiper.pagination.$el.hasClass(swiper.params.pagination.hiddenClass); 5868 if (isHidden === true) { 5869 swiper.emit('paginationShow', swiper); 5870 } else { 5871 swiper.emit('paginationHide', swiper); 5872 } 5873 swiper.pagination.$el.toggleClass(swiper.params.pagination.hiddenClass); 5874 } 5875 }, 5876 }, 5877 }; 5878 5879 var Scrollbar = { 5880 setTranslate: function setTranslate() { 5881 var swiper = this; 5882 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) { return; } 5883 var scrollbar = swiper.scrollbar; 5884 var rtl = swiper.rtlTranslate; 5885 var progress = swiper.progress; 5886 var dragSize = scrollbar.dragSize; 5887 var trackSize = scrollbar.trackSize; 5888 var $dragEl = scrollbar.$dragEl; 5889 var $el = scrollbar.$el; 5890 var params = swiper.params.scrollbar; 5891 5892 var newSize = dragSize; 5893 var newPos = (trackSize - dragSize) * progress; 5894 if (rtl) { 5895 newPos = -newPos; 5896 if (newPos > 0) { 5897 newSize = dragSize - newPos; 5898 newPos = 0; 5899 } else if (-newPos + dragSize > trackSize) { 5900 newSize = trackSize + newPos; 5901 } 5902 } else if (newPos < 0) { 5903 newSize = dragSize + newPos; 5904 newPos = 0; 5905 } else if (newPos + dragSize > trackSize) { 5906 newSize = trackSize - newPos; 5907 } 5908 if (swiper.isHorizontal()) { 5909
vendor: 5,246 bytes, lines 5909-6056
5909$dragEl.transform(("translate3d(" + newPos + "px, 0, 0)")); 5910 $dragEl[0].style.width = newSize + "px"; 5911 } else { 5912 $dragEl.transform(("translate3d(0px, " + newPos + "px, 0)")); 5913 $dragEl[0].style.height = newSize + "px"; 5914 } 5915 if (params.hide) { 5916 clearTimeout(swiper.scrollbar.timeout); 5917 $el[0].style.opacity = 1; 5918 swiper.scrollbar.timeout = setTimeout(function () { 5919 $el[0].style.opacity = 0; 5920 $el.transition(400); 5921 }, 1000); 5922 } 5923 }, 5924 setTransition: function setTransition(duration) { 5925 var swiper = this; 5926 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) { return; } 5927 swiper.scrollbar.$dragEl.transition(duration); 5928 }, 5929 updateSize: function updateSize() { 5930 var swiper = this; 5931 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) { return; } 5932 5933 var scrollbar = swiper.scrollbar; 5934 var $dragEl = scrollbar.$dragEl; 5935 var $el = scrollbar.$el; 5936 5937 $dragEl[0].style.width = ''; 5938 $dragEl[0].style.height = ''; 5939 var trackSize = swiper.isHorizontal() ? $el[0].offsetWidth : $el[0].offsetHeight; 5940 5941 var divider = swiper.size / swiper.virtualSize; 5942 var moveDivider = divider * (trackSize / swiper.size); 5943 var dragSize; 5944 if (swiper.params.scrollbar.dragSize === 'auto') { 5945 dragSize = trackSize * divider; 5946 } else { 5947 dragSize = parseInt(swiper.params.scrollbar.dragSize, 10); 5948 } 5949 5950 if (swiper.isHorizontal()) { 5951 $dragEl[0].style.width = dragSize + "px"; 5952 } else { 5953 $dragEl[0].style.height = dragSize + "px"; 5954 } 5955 5956 if (divider >= 1) { 5957 $el[0].style.display = 'none'; 5958 } else { 5959 $el[0].style.display = ''; 5960 } 5961 if (swiper.params.scrollbar.hide) { 5962 $el[0].style.opacity = 0; 5963 } 5964 Utils.extend(scrollbar, { 5965 trackSize: trackSize, 5966 divider: divider, 5967 moveDivider: moveDivider, 5968 dragSize: dragSize, 5969 }); 5970 scrollbar.$el[swiper.params.watchOverflow && swiper.isLocked ? 'addClass' : 'removeClass'](swiper.params.scrollbar.lockClass); 5971 }, 5972 getPointerPosition: function getPointerPosition(e) { 5973 var swiper = this; 5974 if (swiper.isHorizontal()) { 5975 return ((e.type === 'touchstart' || e.type === 'touchmove') ? e.targetTouches[0].clientX : e.clientX); 5976 } 5977 return ((e.type === 'touchstart' || e.type === 'touchmove') ? e.targetTouches[0].clientY : e.clientY); 5978 }, 5979 setDragPosition: function setDragPosition(e) { 5980 var swiper = this; 5981 var scrollbar = swiper.scrollbar; 5982 var rtl = swiper.rtlTranslate; 5983 var $el = scrollbar.$el; 5984 var dragSize = scrollbar.dragSize; 5985 var trackSize = scrollbar.trackSize; 5986 var dragStartPos = scrollbar.dragStartPos; 5987 5988 var positionRatio; 5989 positionRatio = ((scrollbar.getPointerPosition(e)) - $el.offset()[swiper.isHorizontal() ? 'left' : 'top'] 5990 - (dragStartPos !== null ? dragStartPos : dragSize / 2)) / (trackSize - dragSize); 5991 positionRatio = Math.max(Math.min(positionRatio, 1), 0); 5992 if (rtl) { 5993 positionRatio = 1 - positionRatio; 5994 } 5995 5996 var position = swiper.minTranslate() + ((swiper.maxTranslate() - swiper.minTranslate()) * positionRatio); 5997 5998 swiper.updateProgress(position); 5999 swiper.setTranslate(position); 6000 swiper.updateActiveIndex(); 6001 swiper.updateSlidesClasses(); 6002 }, 6003 onDragStart: function onDragStart(e) { 6004 var swiper = this; 6005 var params = swiper.params.scrollbar; 6006 var scrollbar = swiper.scrollbar; 6007 var $wrapperEl = swiper.$wrapperEl; 6008 var $el = scrollbar.$el; 6009 var $dragEl = scrollbar.$dragEl; 6010 swiper.scrollbar.isTouched = true; 6011 swiper.scrollbar.dragStartPos = (e.target === $dragEl[0] || e.target === $dragEl) 6012 ? scrollbar.getPointerPosition(e) - e.target.getBoundingClientRect()[swiper.isHorizontal() ? 'left' : 'top'] : null; 6013 e.preventDefault(); 6014 e.stopPropagation(); 6015 6016 $wrapperEl.transition(100); 6017 $dragEl.transition(100); 6018 scrollbar.setDragPosition(e); 6019 6020 clearTimeout(swiper.scrollbar.dragTimeout); 6021 6022 $el.transition(0); 6023 if (params.hide) { 6024 $el.css('opacity', 1); 6025 } 6026 if (swiper.params.cssMode) { 6027 swiper.$wrapperEl.css('scroll-snap-type', 'none'); 6028 } 6029 swiper.emit('scrollbarDragStart', e); 6030 }, 6031 onDragMove: function onDragMove(e) { 6032 var swiper = this; 6033 var scrollbar = swiper.scrollbar; 6034 var $wrapperEl = swiper.$wrapperEl; 6035 var $el = scrollbar.$el; 6036 var $dragEl = scrollbar.$dragEl; 6037 6038 if (!swiper.scrollbar.isTouched) { return; } 6039 if (e.preventDefault) { e.preventDefault(); } 6040 else { e.returnValue = false; } 6041 scrollbar.setDragPosition(e); 6042 $wrapperEl.transition(0); 6043 $el.transition(0); 6044 $dragEl.transition(0); 6045 swiper.emit('scrollbarDragMove', e); 6046 }, 6047 onDragEnd: function onDragEnd(e) { 6048 var swiper = this; 6049 6050 var params = swiper.params.scrollbar; 6051 var scrollbar = swiper.scrollbar; 6052 var $wrapperEl = swiper.$wrapperEl; 6053 var $el = scrollbar.$el; 6054 6055 if (!swiper.scrollbar.isTouched) { return; } 6056 swiper.scrollbar.isTouched = false;
6057 if (swiper.params.cssMode) { 6058 swiper.$wrapperEl.css('scroll-snap-type', ''); 6059 $wrapperEl.transition(''); 6060 }
vendor: 26,019 bytes, lines 6060-6723
6060 6061 if (params.hide) { 6062 clearTimeout(swiper.scrollbar.dragTimeout); 6063 swiper.scrollbar.dragTimeout = Utils.nextTick(function () { 6064 $el.css('opacity', 0); 6065 $el.transition(400); 6066 }, 1000); 6067 } 6068 swiper.emit('scrollbarDragEnd', e); 6069 if (params.snapOnRelease) { 6070 swiper.slideToClosest(); 6071 } 6072 }, 6073 enableDraggable: function enableDraggable() { 6074 var swiper = this; 6075 if (!swiper.params.scrollbar.el) { return; } 6076 var scrollbar = swiper.scrollbar; 6077 var touchEventsTouch = swiper.touchEventsTouch; 6078 var touchEventsDesktop = swiper.touchEventsDesktop; 6079 var params = swiper.params; 6080 var $el = scrollbar.$el; 6081 var target = $el[0]; 6082 var activeListener = Support.passiveListener && params.passiveListeners ? { passive: false, capture: false } : false; 6083 var passiveListener = Support.passiveListener && params.passiveListeners ? { passive: true, capture: false } : false; 6084 if (!Support.touch) { 6085 target.addEventListener(touchEventsDesktop.start, swiper.scrollbar.onDragStart, activeListener); 6086 doc.addEventListener(touchEventsDesktop.move, swiper.scrollbar.onDragMove, activeListener); 6087 doc.addEventListener(touchEventsDesktop.end, swiper.scrollbar.onDragEnd, passiveListener); 6088 } else { 6089 target.addEventListener(touchEventsTouch.start, swiper.scrollbar.onDragStart, activeListener); 6090 target.addEventListener(touchEventsTouch.move, swiper.scrollbar.onDragMove, activeListener); 6091 target.addEventListener(touchEventsTouch.end, swiper.scrollbar.onDragEnd, passiveListener); 6092 } 6093 }, 6094 disableDraggable: function disableDraggable() { 6095 var swiper = this; 6096 if (!swiper.params.scrollbar.el) { return; } 6097 var scrollbar = swiper.scrollbar; 6098 var touchEventsTouch = swiper.touchEventsTouch; 6099 var touchEventsDesktop = swiper.touchEventsDesktop; 6100 var params = swiper.params; 6101 var $el = scrollbar.$el; 6102 var target = $el[0]; 6103 var activeListener = Support.passiveListener && params.passiveListeners ? { passive: false, capture: false } : false; 6104 var passiveListener = Support.passiveListener && params.passiveListeners ? { passive: true, capture: false } : false; 6105 if (!Support.touch) { 6106 target.removeEventListener(touchEventsDesktop.start, swiper.scrollbar.onDragStart, activeListener); 6107 doc.removeEventListener(touchEventsDesktop.move, swiper.scrollbar.onDragMove, activeListener); 6108 doc.removeEventListener(touchEventsDesktop.end, swiper.scrollbar.onDragEnd, passiveListener); 6109 } else { 6110 target.removeEventListener(touchEventsTouch.start, swiper.scrollbar.onDragStart, activeListener); 6111 target.removeEventListener(touchEventsTouch.move, swiper.scrollbar.onDragMove, activeListener); 6112 target.removeEventListener(touchEventsTouch.end, swiper.scrollbar.onDragEnd, passiveListener); 6113 } 6114 }, 6115 init: function init() { 6116 var swiper = this; 6117 if (!swiper.params.scrollbar.el) { return; } 6118 var scrollbar = swiper.scrollbar; 6119 var $swiperEl = swiper.$el; 6120 var params = swiper.params.scrollbar; 6121 6122 var $el = $(params.el); 6123 if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1 && $swiperEl.find(params.el).length === 1) { 6124 $el = $swiperEl.find(params.el); 6125 } 6126 6127 var $dragEl = $el.find(("." + (swiper.params.scrollbar.dragClass))); 6128 if ($dragEl.length === 0) { 6129 $dragEl = $(("<div class=\"" + (swiper.params.scrollbar.dragClass) + "\"></div>")); 6130 $el.append($dragEl); 6131 } 6132 6133 Utils.extend(scrollbar, { 6134 $el: $el, 6135 el: $el[0], 6136 $dragEl: $dragEl, 6137 dragEl: $dragEl[0], 6138 }); 6139 6140 if (params.draggable) { 6141 scrollbar.enableDraggable(); 6142 } 6143 }, 6144 destroy: function destroy() { 6145 var swiper = this; 6146 swiper.scrollbar.disableDraggable(); 6147 }, 6148 }; 6149 6150 var Scrollbar$1 = { 6151 name: 'scrollbar', 6152 params: { 6153 scrollbar: { 6154 el: null, 6155 dragSize: 'auto', 6156 hide: false, 6157 draggable: false, 6158 snapOnRelease: true, 6159 lockClass: 'swiper-scrollbar-lock', 6160 dragClass: 'swiper-scrollbar-drag', 6161 }, 6162 }, 6163 create: function create() { 6164 var swiper = this; 6165 Utils.extend(swiper, { 6166 scrollbar: { 6167 init: Scrollbar.init.bind(swiper), 6168 destroy: Scrollbar.destroy.bind(swiper), 6169 updateSize: Scrollbar.updateSize.bind(swiper), 6170 setTranslate: Scrollbar.setTranslate.bind(swiper), 6171 setTransition: Scrollbar.setTransition.bind(swiper), 6172 enableDraggable: Scrollbar.enableDraggable.bind(swiper), 6173 disableDraggable: Scrollbar.disableDraggable.bind(swiper), 6174 setDragPosition: Scrollbar.setDragPosition.bind(swiper), 6175 getPointerPosition: Scrollbar.getPointerPosition.bind(swiper), 6176 onDragStart: Scrollbar.onDragStart.bind(swiper), 6177 onDragMove: Scrollbar.onDragMove.bind(swiper), 6178 onDragEnd: Scrollbar.onDragEnd.bind(swiper), 6179 isTouched: false, 6180 timeout: null, 6181 dragTimeout: null, 6182 }, 6183 }); 6184 }, 6185 on: { 6186 init: function init() { 6187 var swiper = this; 6188 swiper.scrollbar.init(); 6189 swiper.scrollbar.updateSize(); 6190 swiper.scrollbar.setTranslate(); 6191 }, 6192 update: function update() { 6193 var swiper = this; 6194 swiper.scrollbar.updateSize(); 6195 }, 6196 resize: function resize() { 6197 var swiper = this; 6198 swiper.scrollbar.updateSize(); 6199 }, 6200 observerUpdate: function observerUpdate() { 6201 var swiper = this; 6202 swiper.scrollbar.updateSize(); 6203 }, 6204 setTranslate: function setTranslate() { 6205 var swiper = this; 6206 swiper.scrollbar.setTranslate(); 6207 }, 6208 setTransition: function setTransition(duration) { 6209 var swiper = this; 6210 swiper.scrollbar.setTransition(duration); 6211 }, 6212 destroy: function destroy() { 6213 var swiper = this; 6214 swiper.scrollbar.destroy(); 6215 }, 6216 }, 6217 }; 6218 6219 var Parallax = { 6220 setTransform: function setTransform(el, progress) { 6221 var swiper = this; 6222 var rtl = swiper.rtl; 6223 6224 var $el = $(el); 6225 var rtlFactor = rtl ? -1 : 1; 6226 6227 var p = $el.attr('data-swiper-parallax') || '0'; 6228 var x = $el.attr('data-swiper-parallax-x'); 6229 var y = $el.attr('data-swiper-parallax-y'); 6230 var scale = $el.attr('data-swiper-parallax-scale'); 6231 var opacity = $el.attr('data-swiper-parallax-opacity'); 6232 6233 if (x || y) { 6234 x = x || '0'; 6235 y = y || '0'; 6236 } else if (swiper.isHorizontal()) { 6237 x = p; 6238 y = '0'; 6239 } else { 6240 y = p; 6241 x = '0'; 6242 } 6243 6244 if ((x).indexOf('%') >= 0) { 6245 x = (parseInt(x, 10) * progress * rtlFactor) + "%"; 6246 } else { 6247 x = (x * progress * rtlFactor) + "px"; 6248 } 6249 if ((y).indexOf('%') >= 0) { 6250 y = (parseInt(y, 10) * progress) + "%"; 6251 } else { 6252 y = (y * progress) + "px"; 6253 } 6254 6255 if (typeof opacity !== 'undefined' && opacity !== null) { 6256 var currentOpacity = opacity - ((opacity - 1) * (1 - Math.abs(progress))); 6257 $el[0].style.opacity = currentOpacity; 6258 } 6259 if (typeof scale === 'undefined' || scale === null) { 6260 $el.transform(("translate3d(" + x + ", " + y + ", 0px)")); 6261 } else { 6262 var currentScale = scale - ((scale - 1) * (1 - Math.abs(progress))); 6263 $el.transform(("translate3d(" + x + ", " + y + ", 0px) scale(" + currentScale + ")")); 6264 } 6265 }, 6266 setTranslate: function setTranslate() { 6267 var swiper = this; 6268 var $el = swiper.$el; 6269 var slides = swiper.slides; 6270 var progress = swiper.progress; 6271 var snapGrid = swiper.snapGrid; 6272 $el.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]') 6273 .each(function (index, el) { 6274 swiper.parallax.setTransform(el, progress); 6275 }); 6276 slides.each(function (slideIndex, slideEl) { 6277 var slideProgress = slideEl.progress; 6278 if (swiper.params.slidesPerGroup > 1 && swiper.params.slidesPerView !== 'auto') { 6279 slideProgress += Math.ceil(slideIndex / 2) - (progress * (snapGrid.length - 1)); 6280 } 6281 slideProgress = Math.min(Math.max(slideProgress, -1), 1); 6282 $(slideEl).find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]') 6283 .each(function (index, el) { 6284 swiper.parallax.setTransform(el, slideProgress); 6285 }); 6286 }); 6287 }, 6288 setTransition: function setTransition(duration) { 6289 if ( duration === void 0 ) duration = this.params.speed; 6290 6291 var swiper = this; 6292 var $el = swiper.$el; 6293 $el.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]') 6294 .each(function (index, parallaxEl) { 6295 var $parallaxEl = $(parallaxEl); 6296 var parallaxDuration = parseInt($parallaxEl.attr('data-swiper-parallax-duration'), 10) || duration; 6297 if (duration === 0) { parallaxDuration = 0; } 6298 $parallaxEl.transition(parallaxDuration); 6299 }); 6300 }, 6301 }; 6302 6303 var Parallax$1 = { 6304 name: 'parallax', 6305 params: { 6306 parallax: { 6307 enabled: false, 6308 }, 6309 }, 6310 create: function create() { 6311 var swiper = this; 6312 Utils.extend(swiper, { 6313 parallax: { 6314 setTransform: Parallax.setTransform.bind(swiper), 6315 setTranslate: Parallax.setTranslate.bind(swiper), 6316 setTransition: Parallax.setTransition.bind(swiper), 6317 }, 6318 }); 6319 }, 6320 on: { 6321 beforeInit: function beforeInit() { 6322 var swiper = this; 6323 if (!swiper.params.parallax.enabled) { return; } 6324 swiper.params.watchSlidesProgress = true; 6325 swiper.originalParams.watchSlidesProgress = true; 6326 }, 6327 init: function init() { 6328 var swiper = this; 6329 if (!swiper.params.parallax.enabled) { return; } 6330 swiper.parallax.setTranslate(); 6331 }, 6332 setTranslate: function setTranslate() { 6333 var swiper = this; 6334 if (!swiper.params.parallax.enabled) { return; } 6335 swiper.parallax.setTranslate(); 6336 }, 6337 setTransition: function setTransition(duration) { 6338 var swiper = this; 6339 if (!swiper.params.parallax.enabled) { return; } 6340 swiper.parallax.setTransition(duration); 6341 }, 6342 }, 6343 }; 6344 6345 var Zoom = { 6346 // Calc Scale From Multi-touches 6347 getDistanceBetweenTouches: function getDistanceBetweenTouches(e) { 6348 if (e.targetTouches.length < 2) { return 1; } 6349 var x1 = e.targetTouches[0].pageX; 6350 var y1 = e.targetTouches[0].pageY; 6351 var x2 = e.targetTouches[1].pageX; 6352 var y2 = e.targetTouches[1].pageY; 6353 var distance = Math.sqrt((Math.pow( (x2 - x1), 2 )) + (Math.pow( (y2 - y1), 2 ))); 6354 return distance; 6355 }, 6356 // Events 6357 onGestureStart: function onGestureStart(e) { 6358 var swiper = this; 6359 var params = swiper.params.zoom; 6360 var zoom = swiper.zoom; 6361 var gesture = zoom.gesture; 6362 zoom.fakeGestureTouched = false; 6363 zoom.fakeGestureMoved = false; 6364 if (!Support.gestures) { 6365 if (e.type !== 'touchstart' || (e.type === 'touchstart' && e.targetTouches.length < 2)) { 6366 return; 6367 } 6368 zoom.fakeGestureTouched = true; 6369 gesture.scaleStart = Zoom.getDistanceBetweenTouches(e); 6370 } 6371 if (!gesture.$slideEl || !gesture.$slideEl.length) { 6372 gesture.$slideEl = $(e.target).closest('.swiper-slide'); 6373 if (gesture.$slideEl.length === 0) { gesture.$slideEl = swiper.slides.eq(swiper.activeIndex); } 6374 gesture.$imageEl = gesture.$slideEl.find('img, svg, canvas'); 6375 gesture.$imageWrapEl = gesture.$imageEl.parent(("." + (params.containerClass))); 6376 gesture.maxRatio = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio; 6377 if (gesture.$imageWrapEl.length === 0) { 6378 gesture.$imageEl = undefined; 6379 return; 6380 } 6381 } 6382 gesture.$imageEl.transition(0); 6383 swiper.zoom.isScaling = true; 6384 }, 6385 onGestureChange: function onGestureChange(e) { 6386 var swiper = this; 6387 var params = swiper.params.zoom; 6388 var zoom = swiper.zoom; 6389 var gesture = zoom.gesture; 6390 if (!Support.gestures) { 6391 if (e.type !== 'touchmove' || (e.type === 'touchmove' && e.targetTouches.length < 2)) { 6392 return; 6393 } 6394 zoom.fakeGestureMoved = true; 6395 gesture.scaleMove = Zoom.getDistanceBetweenTouches(e); 6396 } 6397 if (!gesture.$imageEl || gesture.$imageEl.length === 0) { return; } 6398 if (Support.gestures) { 6399 zoom.scale = e.scale * zoom.currentScale; 6400 } else { 6401 zoom.scale = (gesture.scaleMove / gesture.scaleStart) * zoom.currentScale; 6402 } 6403 if (zoom.scale > gesture.maxRatio) { 6404 zoom.scale = (gesture.maxRatio - 1) + (Math.pow( ((zoom.scale - gesture.maxRatio) + 1), 0.5 )); 6405 } 6406 if (zoom.scale < params.minRatio) { 6407 zoom.scale = (params.minRatio + 1) - (Math.pow( ((params.minRatio - zoom.scale) + 1), 0.5 )); 6408 } 6409 gesture.$imageEl.transform(("translate3d(0,0,0) scale(" + (zoom.scale) + ")")); 6410 }, 6411 onGestureEnd: function onGestureEnd(e) { 6412 var swiper = this; 6413 var params = swiper.params.zoom; 6414 var zoom = swiper.zoom; 6415 var gesture = zoom.gesture; 6416 if (!Support.gestures) { 6417 if (!zoom.fakeGestureTouched || !zoom.fakeGestureMoved) { 6418 return; 6419 } 6420 if (e.type !== 'touchend' || (e.type === 'touchend' && e.changedTouches.length < 2 && !Device.android)) { 6421 return; 6422 } 6423 zoom.fakeGestureTouched = false; 6424 zoom.fakeGestureMoved = false; 6425 } 6426 if (!gesture.$imageEl || gesture.$imageEl.length === 0) { return; } 6427 zoom.scale = Math.max(Math.min(zoom.scale, gesture.maxRatio), params.minRatio); 6428 gesture.$imageEl.transition(swiper.params.speed).transform(("translate3d(0,0,0) scale(" + (zoom.scale) + ")")); 6429 zoom.currentScale = zoom.scale; 6430 zoom.isScaling = false; 6431 if (zoom.scale === 1) { gesture.$slideEl = undefined; } 6432 }, 6433 onTouchStart: function onTouchStart(e) { 6434 var swiper = this; 6435 var zoom = swiper.zoom; 6436 var gesture = zoom.gesture; 6437 var image = zoom.image; 6438 if (!gesture.$imageEl || gesture.$imageEl.length === 0) { return; } 6439 if (image.isTouched) { return; } 6440 if (Device.android) { e.preventDefault(); } 6441 image.isTouched = true; 6442 image.touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX; 6443 image.touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY; 6444 }, 6445 onTouchMove: function onTouchMove(e) { 6446 var swiper = this; 6447 var zoom = swiper.zoom; 6448 var gesture = zoom.gesture; 6449 var image = zoom.image; 6450 var velocity = zoom.velocity; 6451 if (!gesture.$imageEl || gesture.$imageEl.length === 0) { return; } 6452 swiper.allowClick = false; 6453 if (!image.isTouched || !gesture.$slideEl) { return; } 6454 6455 if (!image.isMoved) { 6456 image.width = gesture.$imageEl[0].offsetWidth; 6457 image.height = gesture.$imageEl[0].offsetHeight; 6458 image.startX = Utils.getTranslate(gesture.$imageWrapEl[0], 'x') || 0; 6459 image.startY = Utils.getTranslate(gesture.$imageWrapEl[0], 'y') || 0; 6460 gesture.slideWidth = gesture.$slideEl[0].offsetWidth; 6461 gesture.slideHeight = gesture.$slideEl[0].offsetHeight; 6462 gesture.$imageWrapEl.transition(0); 6463 if (swiper.rtl) { 6464 image.startX = -image.startX; 6465 image.startY = -image.startY; 6466 } 6467 } 6468 // Define if we need image drag 6469 var scaledWidth = image.width * zoom.scale; 6470 var scaledHeight = image.height * zoom.scale; 6471 6472 if (scaledWidth < gesture.slideWidth && scaledHeight < gesture.slideHeight) { return; } 6473 6474 image.minX = Math.min(((gesture.slideWidth / 2) - (scaledWidth / 2)), 0); 6475 image.maxX = -image.minX; 6476 image.minY = Math.min(((gesture.slideHeight / 2) - (scaledHeight / 2)), 0); 6477 image.maxY = -image.minY; 6478 6479 image.touchesCurrent.x = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX; 6480 image.touchesCurrent.y = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY; 6481 6482 if (!image.isMoved && !zoom.isScaling) { 6483 if ( 6484 swiper.isHorizontal() 6485 && ( 6486 (Math.floor(image.minX) === Math.floor(image.startX) && image.touchesCurrent.x < image.touchesStart.x) 6487 || (Math.floor(image.maxX) === Math.floor(image.startX) && image.touchesCurrent.x > image.touchesStart.x) 6488 ) 6489 ) { 6490 image.isTouched = false; 6491 return; 6492 } if ( 6493 !swiper.isHorizontal() 6494 && ( 6495 (Math.floor(image.minY) === Math.floor(image.startY) && image.touchesCurrent.y < image.touchesStart.y) 6496 || (Math.floor(image.maxY) === Math.floor(image.startY) && image.touchesCurrent.y > image.touchesStart.y) 6497 ) 6498 ) { 6499 image.isTouched = false; 6500 return; 6501 } 6502 } 6503 e.preventDefault(); 6504 e.stopPropagation(); 6505 6506 image.isMoved = true; 6507 image.currentX = (image.touchesCurrent.x - image.touchesStart.x) + image.startX; 6508 image.currentY = (image.touchesCurrent.y - image.touchesStart.y) + image.startY; 6509 6510 if (image.currentX < image.minX) { 6511 image.currentX = (image.minX + 1) - (Math.pow( ((image.minX - image.currentX) + 1), 0.8 )); 6512 } 6513 if (image.currentX > image.maxX) { 6514 image.currentX = (image.maxX - 1) + (Math.pow( ((image.currentX - image.maxX) + 1), 0.8 )); 6515 } 6516 6517 if (image.currentY < image.minY) { 6518 image.currentY = (image.minY + 1) - (Math.pow( ((image.minY - image.currentY) + 1), 0.8 )); 6519 } 6520 if (image.currentY > image.maxY) { 6521 image.currentY = (image.maxY - 1) + (Math.pow( ((image.currentY - image.maxY) + 1), 0.8 )); 6522 } 6523 6524 // Velocity 6525 if (!velocity.prevPositionX) { velocity.prevPositionX = image.touchesCurrent.x; } 6526 if (!velocity.prevPositionY) { velocity.prevPositionY = image.touchesCurrent.y; } 6527 if (!velocity.prevTime) { velocity.prevTime = Date.now(); } 6528 velocity.x = (image.touchesCurrent.x - velocity.prevPositionX) / (Date.now() - velocity.prevTime) / 2; 6529 velocity.y = (image.touchesCurrent.y - velocity.prevPositionY) / (Date.now() - velocity.prevTime) / 2; 6530 if (Math.abs(image.touchesCurrent.x - velocity.prevPositionX) < 2) { velocity.x = 0; } 6531 if (Math.abs(image.touchesCurrent.y - velocity.prevPositionY) < 2) { velocity.y = 0; } 6532 velocity.prevPositionX = image.touchesCurrent.x; 6533 velocity.prevPositionY = image.touchesCurrent.y; 6534 velocity.prevTime = Date.now(); 6535 6536 gesture.$imageWrapEl.transform(("translate3d(" + (image.currentX) + "px, " + (image.currentY) + "px,0)")); 6537 }, 6538 onTouchEnd: function onTouchEnd() { 6539 var swiper = this; 6540 var zoom = swiper.zoom; 6541 var gesture = zoom.gesture; 6542 var image = zoom.image; 6543 var velocity = zoom.velocity; 6544 if (!gesture.$imageEl || gesture.$imageEl.length === 0) { return; } 6545 if (!image.isTouched || !image.isMoved) { 6546 image.isTouched = false; 6547 image.isMoved = false; 6548 return; 6549 } 6550 image.isTouched = false; 6551 image.isMoved = false; 6552 var momentumDurationX = 300; 6553 var momentumDurationY = 300; 6554 var momentumDistanceX = velocity.x * momentumDurationX; 6555 var newPositionX = image.currentX + momentumDistanceX; 6556 var momentumDistanceY = velocity.y * momentumDurationY; 6557 var newPositionY = image.currentY + momentumDistanceY; 6558 6559 // Fix duration 6560 if (velocity.x !== 0) { momentumDurationX = Math.abs((newPositionX - image.currentX) / velocity.x); } 6561 if (velocity.y !== 0) { momentumDurationY = Math.abs((newPositionY - image.currentY) / velocity.y); } 6562 var momentumDuration = Math.max(momentumDurationX, momentumDurationY); 6563 6564 image.currentX = newPositionX; 6565 image.currentY = newPositionY; 6566 6567 // Define if we need image drag 6568 var scaledWidth = image.width * zoom.scale; 6569 var scaledHeight = image.height * zoom.scale; 6570 image.minX = Math.min(((gesture.slideWidth / 2) - (scaledWidth / 2)), 0); 6571 image.maxX = -image.minX; 6572 image.minY = Math.min(((gesture.slideHeight / 2) - (scaledHeight / 2)), 0); 6573 image.maxY = -image.minY; 6574 image.currentX = Math.max(Math.min(image.currentX, image.maxX), image.minX); 6575 image.currentY = Math.max(Math.min(image.currentY, image.maxY), image.minY); 6576 6577 gesture.$imageWrapEl.transition(momentumDuration).transform(("translate3d(" + (image.currentX) + "px, " + (image.currentY) + "px,0)")); 6578 }, 6579 onTransitionEnd: function onTransitionEnd() { 6580 var swiper = this; 6581 var zoom = swiper.zoom; 6582 var gesture = zoom.gesture; 6583 if (gesture.$slideEl && swiper.previousIndex !== swiper.activeIndex) { 6584 gesture.$imageEl.transform('translate3d(0,0,0) scale(1)'); 6585 gesture.$imageWrapEl.transform('translate3d(0,0,0)'); 6586 6587 zoom.scale = 1; 6588 zoom.currentScale = 1; 6589 6590 gesture.$slideEl = undefined; 6591 gesture.$imageEl = undefined; 6592 gesture.$imageWrapEl = undefined; 6593 } 6594 }, 6595 // Toggle Zoom 6596 toggle: function toggle(e) { 6597 var swiper = this; 6598 var zoom = swiper.zoom; 6599 6600 if (zoom.scale && zoom.scale !== 1) { 6601 // Zoom Out 6602 zoom.out(); 6603 } else { 6604 // Zoom In 6605 zoom.in(e); 6606 } 6607 }, 6608 in: function in$1(e) { 6609 var swiper = this; 6610 6611 var zoom = swiper.zoom; 6612 var params = swiper.params.zoom; 6613 var gesture = zoom.gesture; 6614 var image = zoom.image; 6615 6616 if (!gesture.$slideEl) { 6617 gesture.$slideEl = swiper.clickedSlide ? $(swiper.clickedSlide) : swiper.slides.eq(swiper.activeIndex); 6618 gesture.$imageEl = gesture.$slideEl.find('img, svg, canvas'); 6619 gesture.$imageWrapEl = gesture.$imageEl.parent(("." + (params.containerClass))); 6620 } 6621 if (!gesture.$imageEl || gesture.$imageEl.length === 0) { return; } 6622 6623 gesture.$slideEl.addClass(("" + (params.zoomedSlideClass))); 6624 6625 var touchX; 6626 var touchY; 6627 var offsetX; 6628 var offsetY; 6629 var diffX; 6630 var diffY; 6631 var translateX; 6632 var translateY; 6633 var imageWidth; 6634 var imageHeight; 6635 var scaledWidth; 6636 var scaledHeight; 6637 var translateMinX; 6638 var translateMinY; 6639 var translateMaxX; 6640 var translateMaxY; 6641 var slideWidth; 6642 var slideHeight; 6643 6644 if (typeof image.touchesStart.x === 'undefined' && e) { 6645 touchX = e.type === 'touchend' ? e.changedTouches[0].pageX : e.pageX; 6646 touchY = e.type === 'touchend' ? e.changedTouches[0].pageY : e.pageY; 6647 } else { 6648 touchX = image.touchesStart.x; 6649 touchY = image.touchesStart.y; 6650 } 6651 6652 zoom.scale = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio; 6653 zoom.currentScale = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio; 6654 if (e) { 6655 slideWidth = gesture.$slideEl[0].offsetWidth; 6656 slideHeight = gesture.$slideEl[0].offsetHeight; 6657 offsetX = gesture.$slideEl.offset().left; 6658 offsetY = gesture.$slideEl.offset().top; 6659 diffX = (offsetX + (slideWidth / 2)) - touchX; 6660 diffY = (offsetY + (slideHeight / 2)) - touchY; 6661 6662 imageWidth = gesture.$imageEl[0].offsetWidth; 6663 imageHeight = gesture.$imageEl[0].offsetHeight; 6664 scaledWidth = imageWidth * zoom.scale; 6665 scaledHeight = imageHeight * zoom.scale; 6666 6667 translateMinX = Math.min(((slideWidth / 2) - (scaledWidth / 2)), 0); 6668 translateMinY = Math.min(((slideHeight / 2) - (scaledHeight / 2)), 0); 6669 translateMaxX = -translateMinX; 6670 translateMaxY = -translateMinY; 6671 6672 translateX = diffX * zoom.scale; 6673 translateY = diffY * zoom.scale; 6674 6675 if (translateX < translateMinX) { 6676 translateX = translateMinX; 6677 } 6678 if (translateX > translateMaxX) { 6679 translateX = translateMaxX; 6680 } 6681 6682 if (translateY < translateMinY) { 6683 translateY = translateMinY; 6684 } 6685 if (translateY > translateMaxY) { 6686 translateY = translateMaxY; 6687 } 6688 } else { 6689 translateX = 0; 6690 translateY = 0; 6691 } 6692 gesture.$imageWrapEl.transition(300).transform(("translate3d(" + translateX + "px, " + translateY + "px,0)")); 6693 gesture.$imageEl.transition(300).transform(("translate3d(0,0,0) scale(" + (zoom.scale) + ")")); 6694 }, 6695 out: function out() { 6696 var swiper = this; 6697 6698 var zoom = swiper.zoom; 6699 var params = swiper.params.zoom; 6700 var gesture = zoom.gesture; 6701 6702 if (!gesture.$slideEl) { 6703 gesture.$slideEl = swiper.clickedSlide ? $(swiper.clickedSlide) : swiper.slides.eq(swiper.activeIndex); 6704 gesture.$imageEl = gesture.$slideEl.find('img, svg, canvas'); 6705 gesture.$imageWrapEl = gesture.$imageEl.parent(("." + (params.containerClass))); 6706 } 6707 if (!gesture.$imageEl || gesture.$imageEl.length === 0) { return; } 6708 6709 zoom.scale = 1; 6710 zoom.currentScale = 1; 6711 gesture.$imageWrapEl.transition(300).transform('translate3d(0,0,0)'); 6712 gesture.$imageEl.transition(300).transform('translate3d(0,0,0) scale(1)'); 6713 gesture.$slideEl.removeClass(("" + (params.zoomedSlideClass))); 6714 gesture.$slideEl = undefined; 6715 }, 6716 // Attach/Detach Events 6717 enable: function enable() { 6718 var swiper = this; 6719 var zoom = swiper.zoom; 6720 if (zoom.enabled) { return; } 6721 zoom.enabled = true; 6722 6723 var passiveListener = swiper.touchEvents.start === 'touchstart' && Support.passiveListener && swiper.params.passiveListeners ? { passive: true, capture: false } : false;
vendor: 23,050 bytes, lines 6724-7346
6724 var activeListenerWithCapture = Support.passiveListener ? { passive: false, capture: true } : true; 6725 6726 // Scale image 6727 if (Support.gestures) { 6728 swiper.$wrapperEl.on('gesturestart', '.swiper-slide', zoom.onGestureStart, passiveListener); 6729 swiper.$wrapperEl.on('gesturechange', '.swiper-slide', zoom.onGestureChange, passiveListener); 6730 swiper.$wrapperEl.on('gestureend', '.swiper-slide', zoom.onGestureEnd, passiveListener); 6731 } else if (swiper.touchEvents.start === 'touchstart') { 6732 swiper.$wrapperEl.on(swiper.touchEvents.start, '.swiper-slide', zoom.onGestureStart, passiveListener); 6733 swiper.$wrapperEl.on(swiper.touchEvents.move, '.swiper-slide', zoom.onGestureChange, activeListenerWithCapture); 6734 swiper.$wrapperEl.on(swiper.touchEvents.end, '.swiper-slide', zoom.onGestureEnd, passiveListener); 6735 if (swiper.touchEvents.cancel) { 6736 swiper.$wrapperEl.on(swiper.touchEvents.cancel, '.swiper-slide', zoom.onGestureEnd, passiveListener); 6737 } 6738 } 6739 6740 // Move image 6741 swiper.$wrapperEl.on(swiper.touchEvents.move, ("." + (swiper.params.zoom.containerClass)), zoom.onTouchMove, activeListenerWithCapture); 6742 }, 6743 disable: function disable() { 6744 var swiper = this; 6745 var zoom = swiper.zoom; 6746 if (!zoom.enabled) { return; } 6747 6748 swiper.zoom.enabled = false; 6749 6750 var passiveListener = swiper.touchEvents.start === 'touchstart' && Support.passiveListener && swiper.params.passiveListeners ? { passive: true, capture: false } : false; 6751 var activeListenerWithCapture = Support.passiveListener ? { passive: false, capture: true } : true; 6752 6753 // Scale image 6754 if (Support.gestures) { 6755 swiper.$wrapperEl.off('gesturestart', '.swiper-slide', zoom.onGestureStart, passiveListener); 6756 swiper.$wrapperEl.off('gesturechange', '.swiper-slide', zoom.onGestureChange, passiveListener); 6757 swiper.$wrapperEl.off('gestureend', '.swiper-slide', zoom.onGestureEnd, passiveListener); 6758 } else if (swiper.touchEvents.start === 'touchstart') { 6759 swiper.$wrapperEl.off(swiper.touchEvents.start, '.swiper-slide', zoom.onGestureStart, passiveListener); 6760 swiper.$wrapperEl.off(swiper.touchEvents.move, '.swiper-slide', zoom.onGestureChange, activeListenerWithCapture); 6761 swiper.$wrapperEl.off(swiper.touchEvents.end, '.swiper-slide', zoom.onGestureEnd, passiveListener); 6762 if (swiper.touchEvents.cancel) { 6763 swiper.$wrapperEl.off(swiper.touchEvents.cancel, '.swiper-slide', zoom.onGestureEnd, passiveListener); 6764 } 6765 } 6766 6767 // Move image 6768 swiper.$wrapperEl.off(swiper.touchEvents.move, ("." + (swiper.params.zoom.containerClass)), zoom.onTouchMove, activeListenerWithCapture); 6769 }, 6770 }; 6771 6772 var Zoom$1 = { 6773 name: 'zoom', 6774 params: { 6775 zoom: { 6776 enabled: false, 6777 maxRatio: 3, 6778 minRatio: 1, 6779 toggle: true, 6780 containerClass: 'swiper-zoom-container', 6781 zoomedSlideClass: 'swiper-slide-zoomed', 6782 }, 6783 }, 6784 create: function create() { 6785 var swiper = this; 6786 var zoom = { 6787 enabled: false, 6788 scale: 1, 6789 currentScale: 1, 6790 isScaling: false, 6791 gesture: { 6792 $slideEl: undefined, 6793 slideWidth: undefined, 6794 slideHeight: undefined, 6795 $imageEl: undefined, 6796 $imageWrapEl: undefined, 6797 maxRatio: 3, 6798 }, 6799 image: { 6800 isTouched: undefined, 6801 isMoved: undefined, 6802 currentX: undefined, 6803 currentY: undefined, 6804 minX: undefined, 6805 minY: undefined, 6806 maxX: undefined, 6807 maxY: undefined, 6808 width: undefined, 6809 height: undefined, 6810 startX: undefined, 6811 startY: undefined, 6812 touchesStart: {}, 6813 touchesCurrent: {}, 6814 }, 6815 velocity: { 6816 x: undefined, 6817 y: undefined, 6818 prevPositionX: undefined, 6819 prevPositionY: undefined, 6820 prevTime: undefined, 6821 }, 6822 }; 6823 6824 ('onGestureStart onGestureChange onGestureEnd onTouchStart onTouchMove onTouchEnd onTransitionEnd toggle enable disable in out').split(' ').forEach(function (methodName) { 6825 zoom[methodName] = Zoom[methodName].bind(swiper); 6826 }); 6827 Utils.extend(swiper, { 6828 zoom: zoom, 6829 }); 6830 6831 var scale = 1; 6832 Object.defineProperty(swiper.zoom, 'scale', { 6833 get: function get() { 6834 return scale; 6835 }, 6836 set: function set(value) { 6837 if (scale !== value) { 6838 var imageEl = swiper.zoom.gesture.$imageEl ? swiper.zoom.gesture.$imageEl[0] : undefined; 6839 var slideEl = swiper.zoom.gesture.$slideEl ? swiper.zoom.gesture.$slideEl[0] : undefined; 6840 swiper.emit('zoomChange', value, imageEl, slideEl); 6841 } 6842 scale = value; 6843 }, 6844 }); 6845 }, 6846 on: { 6847 init: function init() { 6848 var swiper = this; 6849 if (swiper.params.zoom.enabled) { 6850 swiper.zoom.enable(); 6851 } 6852 }, 6853 destroy: function destroy() { 6854 var swiper = this; 6855 swiper.zoom.disable(); 6856 }, 6857 touchStart: function touchStart(e) { 6858 var swiper = this; 6859 if (!swiper.zoom.enabled) { return; } 6860 swiper.zoom.onTouchStart(e); 6861 }, 6862 touchEnd: function touchEnd(e) { 6863 var swiper = this; 6864 if (!swiper.zoom.enabled) { return; } 6865 swiper.zoom.onTouchEnd(e); 6866 }, 6867 doubleTap: function doubleTap(e) { 6868 var swiper = this; 6869 if (swiper.params.zoom.enabled && swiper.zoom.enabled && swiper.params.zoom.toggle) { 6870 swiper.zoom.toggle(e); 6871 } 6872 }, 6873 transitionEnd: function transitionEnd() { 6874 var swiper = this; 6875 if (swiper.zoom.enabled && swiper.params.zoom.enabled) { 6876 swiper.zoom.onTransitionEnd(); 6877 } 6878 }, 6879 slideChange: function slideChange() { 6880 var swiper = this; 6881 if (swiper.zoom.enabled && swiper.params.zoom.enabled && swiper.params.cssMode) { 6882 swiper.zoom.onTransitionEnd(); 6883 } 6884 }, 6885 }, 6886 }; 6887 6888 var Lazy = { 6889 loadInSlide: function loadInSlide(index, loadInDuplicate) { 6890 if ( loadInDuplicate === void 0 ) loadInDuplicate = true; 6891 6892 var swiper = this; 6893 var params = swiper.params.lazy; 6894 if (typeof index === 'undefined') { return; } 6895 if (swiper.slides.length === 0) { return; } 6896 var isVirtual = swiper.virtual && swiper.params.virtual.enabled; 6897 6898 var $slideEl = isVirtual 6899 ? swiper.$wrapperEl.children(("." + (swiper.params.slideClass) + "[data-swiper-slide-index=\"" + index + "\"]")) 6900 : swiper.slides.eq(index); 6901 6902 var $images = $slideEl.find(("." + (params.elementClass) + ":not(." + (params.loadedClass) + "):not(." + (params.loadingClass) + ")")); 6903 if ($slideEl.hasClass(params.elementClass) && !$slideEl.hasClass(params.loadedClass) && !$slideEl.hasClass(params.loadingClass)) { 6904 $images = $images.add($slideEl[0]); 6905 } 6906 if ($images.length === 0) { return; } 6907 6908 $images.each(function (imageIndex, imageEl) { 6909 var $imageEl = $(imageEl); 6910 $imageEl.addClass(params.loadingClass); 6911 6912 var background = $imageEl.attr('data-background'); 6913 var src = $imageEl.attr('data-src'); 6914 var srcset = $imageEl.attr('data-srcset'); 6915 var sizes = $imageEl.attr('data-sizes'); 6916 6917 swiper.loadImage($imageEl[0], (src || background), srcset, sizes, false, function () { 6918 if (typeof swiper === 'undefined' || swiper === null || !swiper || (swiper && !swiper.params) || swiper.destroyed) { return; } 6919 if (background) { 6920 $imageEl.css('background-image', ("url(\"" + background + "\")")); 6921 $imageEl.removeAttr('data-background'); 6922 } else { 6923 if (srcset) { 6924 $imageEl.attr('srcset', srcset); 6925 $imageEl.removeAttr('data-srcset'); 6926 } 6927 if (sizes) { 6928 $imageEl.attr('sizes', sizes); 6929 $imageEl.removeAttr('data-sizes'); 6930 } 6931 if (src) { 6932 $imageEl.attr('src', src); 6933 $imageEl.removeAttr('data-src'); 6934 } 6935 } 6936 6937 $imageEl.addClass(params.loadedClass).removeClass(params.loadingClass); 6938 $slideEl.find(("." + (params.preloaderClass))).remove(); 6939 if (swiper.params.loop && loadInDuplicate) { 6940 var slideOriginalIndex = $slideEl.attr('data-swiper-slide-index'); 6941 if ($slideEl.hasClass(swiper.params.slideDuplicateClass)) { 6942 var originalSlide = swiper.$wrapperEl.children(("[data-swiper-slide-index=\"" + slideOriginalIndex + "\"]:not(." + (swiper.params.slideDuplicateClass) + ")")); 6943 swiper.lazy.loadInSlide(originalSlide.index(), false); 6944 } else { 6945 var duplicatedSlide = swiper.$wrapperEl.children(("." + (swiper.params.slideDuplicateClass) + "[data-swiper-slide-index=\"" + slideOriginalIndex + "\"]")); 6946 swiper.lazy.loadInSlide(duplicatedSlide.index(), false); 6947 } 6948 } 6949 swiper.emit('lazyImageReady', $slideEl[0], $imageEl[0]); 6950 }); 6951 6952 swiper.emit('lazyImageLoad', $slideEl[0], $imageEl[0]); 6953 }); 6954 }, 6955 load: function load() { 6956 var swiper = this; 6957 var $wrapperEl = swiper.$wrapperEl; 6958 var swiperParams = swiper.params; 6959 var slides = swiper.slides; 6960 var activeIndex = swiper.activeIndex; 6961 var isVirtual = swiper.virtual && swiperParams.virtual.enabled; 6962 var params = swiperParams.lazy; 6963 6964 var slidesPerView = swiperParams.slidesPerView; 6965 if (slidesPerView === 'auto') { 6966 slidesPerView = 0; 6967 } 6968 6969 function slideExist(index) { 6970 if (isVirtual) { 6971 if ($wrapperEl.children(("." + (swiperParams.slideClass) + "[data-swiper-slide-index=\"" + index + "\"]")).length) { 6972 return true; 6973 } 6974 } else if (slides[index]) { return true; } 6975 return false; 6976 } 6977 function slideIndex(slideEl) { 6978 if (isVirtual) { 6979 return $(slideEl).attr('data-swiper-slide-index'); 6980 } 6981 return $(slideEl).index(); 6982 } 6983 6984 if (!swiper.lazy.initialImageLoaded) { swiper.lazy.initialImageLoaded = true; } 6985 if (swiper.params.watchSlidesVisibility) { 6986 $wrapperEl.children(("." + (swiperParams.slideVisibleClass))).each(function (elIndex, slideEl) { 6987 var index = isVirtual ? $(slideEl).attr('data-swiper-slide-index') : $(slideEl).index(); 6988 swiper.lazy.loadInSlide(index); 6989 }); 6990 } else if (slidesPerView > 1) { 6991 for (var i = activeIndex; i < activeIndex + slidesPerView; i += 1) { 6992 if (slideExist(i)) { swiper.lazy.loadInSlide(i); } 6993 } 6994 } else { 6995 swiper.lazy.loadInSlide(activeIndex); 6996 } 6997 if (params.loadPrevNext) { 6998 if (slidesPerView > 1 || (params.loadPrevNextAmount && params.loadPrevNextAmount > 1)) { 6999 var amount = params.loadPrevNextAmount; 7000 var spv = slidesPerView; 7001 var maxIndex = Math.min(activeIndex + spv + Math.max(amount, spv), slides.length); 7002 var minIndex = Math.max(activeIndex - Math.max(spv, amount), 0); 7003 // Next Slides 7004 for (var i$1 = activeIndex + slidesPerView; i$1 < maxIndex; i$1 += 1) { 7005 if (slideExist(i$1)) { swiper.lazy.loadInSlide(i$1); } 7006 } 7007 // Prev Slides 7008 for (var i$2 = minIndex; i$2 < activeIndex; i$2 += 1) { 7009 if (slideExist(i$2)) { swiper.lazy.loadInSlide(i$2); } 7010 } 7011 } else { 7012 var nextSlide = $wrapperEl.children(("." + (swiperParams.slideNextClass))); 7013 if (nextSlide.length > 0) { swiper.lazy.loadInSlide(slideIndex(nextSlide)); } 7014 7015 var prevSlide = $wrapperEl.children(("." + (swiperParams.slidePrevClass))); 7016 if (prevSlide.length > 0) { swiper.lazy.loadInSlide(slideIndex(prevSlide)); } 7017 } 7018 } 7019 }, 7020 }; 7021 7022 var Lazy$1 = { 7023 name: 'lazy', 7024 params: { 7025 lazy: { 7026 enabled: false, 7027 loadPrevNext: false, 7028 loadPrevNextAmount: 1, 7029 loadOnTransitionStart: false, 7030 7031 elementClass: 'swiper-lazy', 7032 loadingClass: 'swiper-lazy-loading', 7033 loadedClass: 'swiper-lazy-loaded', 7034 preloaderClass: 'swiper-lazy-preloader', 7035 }, 7036 }, 7037 create: function create() { 7038 var swiper = this; 7039 Utils.extend(swiper, { 7040 lazy: { 7041 initialImageLoaded: false, 7042 load: Lazy.load.bind(swiper), 7043 loadInSlide: Lazy.loadInSlide.bind(swiper), 7044 }, 7045 }); 7046 }, 7047 on: { 7048 beforeInit: function beforeInit() { 7049 var swiper = this; 7050 if (swiper.params.lazy.enabled && swiper.params.preloadImages) { 7051 swiper.params.preloadImages = false; 7052 } 7053 }, 7054 init: function init() { 7055 var swiper = this; 7056 if (swiper.params.lazy.enabled && !swiper.params.loop && swiper.params.initialSlide === 0) { 7057 swiper.lazy.load(); 7058 } 7059 }, 7060 scroll: function scroll() { 7061 var swiper = this; 7062 if (swiper.params.freeMode && !swiper.params.freeModeSticky) { 7063 swiper.lazy.load(); 7064 } 7065 }, 7066 resize: function resize() { 7067 var swiper = this; 7068 if (swiper.params.lazy.enabled) { 7069 swiper.lazy.load(); 7070 } 7071 }, 7072 scrollbarDragMove: function scrollbarDragMove() { 7073 var swiper = this; 7074 if (swiper.params.lazy.enabled) { 7075 swiper.lazy.load(); 7076 } 7077 }, 7078 transitionStart: function transitionStart() { 7079 var swiper = this; 7080 if (swiper.params.lazy.enabled) { 7081 if (swiper.params.lazy.loadOnTransitionStart || (!swiper.params.lazy.loadOnTransitionStart && !swiper.lazy.initialImageLoaded)) { 7082 swiper.lazy.load(); 7083 } 7084 } 7085 }, 7086 transitionEnd: function transitionEnd() { 7087 var swiper = this; 7088 if (swiper.params.lazy.enabled && !swiper.params.lazy.loadOnTransitionStart) { 7089 swiper.lazy.load(); 7090 } 7091 }, 7092 slideChange: function slideChange() { 7093 var swiper = this; 7094 if (swiper.params.lazy.enabled && swiper.params.cssMode) { 7095 swiper.lazy.load(); 7096 } 7097 }, 7098 }, 7099 }; 7100 7101 /* eslint no-bitwise: ["error", { "allow": [">>"] }] */ 7102 7103 var Controller = { 7104 LinearSpline: function LinearSpline(x, y) { 7105 var binarySearch = (function search() { 7106 var maxIndex; 7107 var minIndex; 7108 var guess; 7109 return function (array, val) { 7110 minIndex = -1; 7111 maxIndex = array.length; 7112 while (maxIndex - minIndex > 1) { 7113 guess = maxIndex + minIndex >> 1; 7114 if (array[guess] <= val) { 7115 minIndex = guess; 7116 } else { 7117 maxIndex = guess; 7118 } 7119 } 7120 return maxIndex; 7121 }; 7122 }()); 7123 this.x = x; 7124 this.y = y; 7125 this.lastIndex = x.length - 1; 7126 // Given an x value (x2), return the expected y2 value: 7127 // (x1,y1) is the known point before given value, 7128 // (x3,y3) is the known point after given value. 7129 var i1; 7130 var i3; 7131 7132 this.interpolate = function interpolate(x2) { 7133 if (!x2) { return 0; } 7134 7135 // Get the indexes of x1 and x3 (the array indexes before and after given x2): 7136 i3 = binarySearch(this.x, x2); 7137 i1 = i3 - 1; 7138 7139 // We have our indexes i1 & i3, so we can calculate already: 7140 // y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1 7141 return (((x2 - this.x[i1]) * (this.y[i3] - this.y[i1])) / (this.x[i3] - this.x[i1])) + this.y[i1]; 7142 }; 7143 return this; 7144 }, 7145 // xxx: for now i will just save one spline function to to 7146 getInterpolateFunction: function getInterpolateFunction(c) { 7147 var swiper = this; 7148 if (!swiper.controller.spline) { 7149 swiper.controller.spline = swiper.params.loop 7150 ? new Controller.LinearSpline(swiper.slidesGrid, c.slidesGrid) 7151 : new Controller.LinearSpline(swiper.snapGrid, c.snapGrid); 7152 } 7153 }, 7154 setTranslate: function setTranslate(setTranslate$1, byController) { 7155 var swiper = this; 7156 var controlled = swiper.controller.control; 7157 var multiplier; 7158 var controlledTranslate; 7159 function setControlledTranslate(c) { 7160 // this will create an Interpolate function based on the snapGrids 7161 // x is the Grid of the scrolled scroller and y will be the controlled scroller 7162 // it makes sense to create this only once and recall it for the interpolation 7163 // the function does a lot of value caching for performance 7164 var translate = swiper.rtlTranslate ? -swiper.translate : swiper.translate; 7165 if (swiper.params.controller.by === 'slide') { 7166 swiper.controller.getInterpolateFunction(c); 7167 // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid 7168 // but it did not work out 7169 controlledTranslate = -swiper.controller.spline.interpolate(-translate); 7170 } 7171 7172 if (!controlledTranslate || swiper.params.controller.by === 'container') { 7173 multiplier = (c.maxTranslate() - c.minTranslate()) / (swiper.maxTranslate() - swiper.minTranslate()); 7174 controlledTranslate = ((translate - swiper.minTranslate()) * multiplier) + c.minTranslate(); 7175 } 7176 7177 if (swiper.params.controller.inverse) { 7178 controlledTranslate = c.maxTranslate() - controlledTranslate; 7179 } 7180 c.updateProgress(controlledTranslate); 7181 c.setTranslate(controlledTranslate, swiper); 7182 c.updateActiveIndex(); 7183 c.updateSlidesClasses(); 7184 } 7185 if (Array.isArray(controlled)) { 7186 for (var i = 0; i < controlled.length; i += 1) { 7187 if (controlled[i] !== byController && controlled[i] instanceof Swiper) { 7188 setControlledTranslate(controlled[i]); 7189 } 7190 } 7191 } else if (controlled instanceof Swiper && byController !== controlled) { 7192 setControlledTranslate(controlled); 7193 } 7194 }, 7195 setTransition: function setTransition(duration, byController) { 7196 var swiper = this; 7197 var controlled = swiper.controller.control; 7198 var i; 7199 function setControlledTransition(c) { 7200 c.setTransition(duration, swiper); 7201 if (duration !== 0) { 7202 c.transitionStart(); 7203 if (c.params.autoHeight) { 7204 Utils.nextTick(function () { 7205 c.updateAutoHeight(); 7206 }); 7207 } 7208 c.$wrapperEl.transitionEnd(function () { 7209 if (!controlled) { return; } 7210 if (c.params.loop && swiper.params.controller.by === 'slide') { 7211 c.loopFix(); 7212 } 7213 c.transitionEnd(); 7214 }); 7215 } 7216 } 7217 if (Array.isArray(controlled)) { 7218 for (i = 0; i < controlled.length; i += 1) { 7219 if (controlled[i] !== byController && controlled[i] instanceof Swiper) { 7220 setControlledTransition(controlled[i]); 7221 } 7222 } 7223 } else if (controlled instanceof Swiper && byController !== controlled) { 7224 setControlledTransition(controlled); 7225 } 7226 }, 7227 }; 7228 var Controller$1 = { 7229 name: 'controller', 7230 params: { 7231 controller: { 7232 control: undefined, 7233 inverse: false, 7234 by: 'slide', // or 'container' 7235 }, 7236 }, 7237 create: function create() { 7238 var swiper = this; 7239 Utils.extend(swiper, { 7240 controller: { 7241 control: swiper.params.controller.control, 7242 getInterpolateFunction: Controller.getInterpolateFunction.bind(swiper), 7243 setTranslate: Controller.setTranslate.bind(swiper), 7244 setTransition: Controller.setTransition.bind(swiper), 7245 }, 7246 }); 7247 }, 7248 on: { 7249 update: function update() { 7250 var swiper = this; 7251 if (!swiper.controller.control) { return; } 7252 if (swiper.controller.spline) { 7253 swiper.controller.spline = undefined; 7254 delete swiper.controller.spline; 7255 } 7256 }, 7257 resize: function resize() { 7258 var swiper = this; 7259 if (!swiper.controller.control) { return; } 7260 if (swiper.controller.spline) { 7261 swiper.controller.spline = undefined; 7262 delete swiper.controller.spline; 7263 } 7264 }, 7265 observerUpdate: function observerUpdate() { 7266 var swiper = this; 7267 if (!swiper.controller.control) { return; } 7268 if (swiper.controller.spline) { 7269 swiper.controller.spline = undefined; 7270 delete swiper.controller.spline; 7271 } 7272 }, 7273 setTranslate: function setTranslate(translate, byController) { 7274 var swiper = this; 7275 if (!swiper.controller.control) { return; } 7276 swiper.controller.setTranslate(translate, byController); 7277 }, 7278 setTransition: function setTransition(duration, byController) { 7279 var swiper = this; 7280 if (!swiper.controller.control) { return; } 7281 swiper.controller.setTransition(duration, byController); 7282 }, 7283 }, 7284 }; 7285 7286 var a11y = { 7287 makeElFocusable: function makeElFocusable($el) { 7288 $el.attr('tabIndex', '0'); 7289 return $el; 7290 }, 7291 addElRole: function addElRole($el, role) { 7292 $el.attr('role', role); 7293 return $el; 7294 }, 7295 addElLabel: function addElLabel($el, label) { 7296 $el.attr('aria-label', label); 7297 return $el; 7298 }, 7299 disableEl: function disableEl($el) { 7300 $el.attr('aria-disabled', true); 7301 return $el; 7302 }, 7303 enableEl: function enableEl($el) { 7304 $el.attr('aria-disabled', false); 7305 return $el; 7306 }, 7307 onEnterKey: function onEnterKey(e) { 7308 var swiper = this; 7309 var params = swiper.params.a11y; 7310 if (e.keyCode !== 13) { return; } 7311 var $targetEl = $(e.target); 7312 if (swiper.navigation && swiper.navigation.$nextEl && $targetEl.is(swiper.navigation.$nextEl)) { 7313 if (!(swiper.isEnd && !swiper.params.loop)) { 7314 swiper.slideNext(); 7315 } 7316 if (swiper.isEnd) { 7317 swiper.a11y.notify(params.lastSlideMessage); 7318 } else { 7319 swiper.a11y.notify(params.nextSlideMessage); 7320 } 7321 } 7322 if (swiper.navigation && swiper.navigation.$prevEl && $targetEl.is(swiper.navigation.$prevEl)) { 7323 if (!(swiper.isBeginning && !swiper.params.loop)) { 7324 swiper.slidePrev(); 7325 } 7326 if (swiper.isBeginning) { 7327 swiper.a11y.notify(params.firstSlideMessage); 7328 } else { 7329 swiper.a11y.notify(params.prevSlideMessage); 7330 } 7331 } 7332 if (swiper.pagination && $targetEl.is(("." + (swiper.params.pagination.bulletClass)))) { 7333 $targetEl[0].click(); 7334 } 7335 }, 7336 notify: function notify(message) { 7337 var swiper = this; 7338 var notification = swiper.a11y.liveRegion; 7339 if (notification.length === 0) { return; } 7340 notification.html(''); 7341 notification.html(message); 7342 }, 7343 updateNavigation: function updateNavigation() { 7344 var swiper = this; 7345 7346 if (swiper.params.loop || !swiper.navigation
vendor: 9,015 bytes, lines 7346-7609
7346) { return; } 7347 var ref = swiper.navigation; 7348 var $nextEl = ref.$nextEl; 7349 var $prevEl = ref.$prevEl; 7350 7351 if ($prevEl && $prevEl.length > 0) { 7352 if (swiper.isBeginning) { 7353 swiper.a11y.disableEl($prevEl); 7354 } else { 7355 swiper.a11y.enableEl($prevEl); 7356 } 7357 } 7358 if ($nextEl && $nextEl.length > 0) { 7359 if (swiper.isEnd) { 7360 swiper.a11y.disableEl($nextEl); 7361 } else { 7362 swiper.a11y.enableEl($nextEl); 7363 } 7364 } 7365 }, 7366 updatePagination: function updatePagination() { 7367 var swiper = this; 7368 var params = swiper.params.a11y; 7369 if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) { 7370 swiper.pagination.bullets.each(function (bulletIndex, bulletEl) { 7371 var $bulletEl = $(bulletEl); 7372 swiper.a11y.makeElFocusable($bulletEl); 7373 swiper.a11y.addElRole($bulletEl, 'button'); 7374 swiper.a11y.addElLabel($bulletEl, params.paginationBulletMessage.replace(/{{index}}/, $bulletEl.index() + 1)); 7375 }); 7376 } 7377 }, 7378 init: function init() { 7379 var swiper = this; 7380 7381 swiper.$el.append(swiper.a11y.liveRegion); 7382 7383 // Navigation 7384 var params = swiper.params.a11y; 7385 var $nextEl; 7386 var $prevEl; 7387 if (swiper.navigation && swiper.navigation.$nextEl) { 7388 $nextEl = swiper.navigation.$nextEl; 7389 } 7390 if (swiper.navigation && swiper.navigation.$prevEl) { 7391 $prevEl = swiper.navigation.$prevEl; 7392 } 7393 if ($nextEl) { 7394 swiper.a11y.makeElFocusable($nextEl); 7395 swiper.a11y.addElRole($nextEl, 'button'); 7396 swiper.a11y.addElLabel($nextEl, params.nextSlideMessage); 7397 $nextEl.on('keydown', swiper.a11y.onEnterKey); 7398 } 7399 if ($prevEl) { 7400 swiper.a11y.makeElFocusable($prevEl); 7401 swiper.a11y.addElRole($prevEl, 'button'); 7402 swiper.a11y.addElLabel($prevEl, params.prevSlideMessage); 7403 $prevEl.on('keydown', swiper.a11y.onEnterKey); 7404 } 7405 7406 // Pagination 7407 if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) { 7408 swiper.pagination.$el.on('keydown', ("." + (swiper.params.pagination.bulletClass)), swiper.a11y.onEnterKey); 7409 } 7410 }, 7411 destroy: function destroy() { 7412 var swiper = this; 7413 if (swiper.a11y.liveRegion && swiper.a11y.liveRegion.length > 0) { swiper.a11y.liveRegion.remove(); } 7414 7415 var $nextEl; 7416 var $prevEl; 7417 if (swiper.navigation && swiper.navigation.$nextEl) { 7418 $nextEl = swiper.navigation.$nextEl; 7419 } 7420 if (swiper.navigation && swiper.navigation.$prevEl) { 7421 $prevEl = swiper.navigation.$prevEl; 7422 } 7423 if ($nextEl) { 7424 $nextEl.off('keydown', swiper.a11y.onEnterKey); 7425 } 7426 if ($prevEl) { 7427 $prevEl.off('keydown', swiper.a11y.onEnterKey); 7428 } 7429 7430 // Pagination 7431 if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) { 7432 swiper.pagination.$el.off('keydown', ("." + (swiper.params.pagination.bulletClass)), swiper.a11y.onEnterKey); 7433 } 7434 }, 7435 }; 7436 var A11y = { 7437 name: 'a11y', 7438 params: { 7439 a11y: { 7440 enabled: true, 7441 notificationClass: 'swiper-notification', 7442 prevSlideMessage: 'Previous slide', 7443 nextSlideMessage: 'Next slide', 7444 firstSlideMessage: 'This is the first slide', 7445 lastSlideMessage: 'This is the last slide', 7446 paginationBulletMessage: 'Go to slide {{index}}', 7447 }, 7448 }, 7449 create: function create() { 7450 var swiper = this; 7451 Utils.extend(swiper, { 7452 a11y: { 7453 liveRegion: $(("<span class=\"" + (swiper.params.a11y.notificationClass) + "\" aria-live=\"assertive\" aria-atomic=\"true\"></span>")), 7454 }, 7455 }); 7456 Object.keys(a11y).forEach(function (methodName) { 7457 swiper.a11y[methodName] = a11y[methodName].bind(swiper); 7458 }); 7459 }, 7460 on: { 7461 init: function init() { 7462 var swiper = this; 7463 if (!swiper.params.a11y.enabled) { return; } 7464 swiper.a11y.init(); 7465 swiper.a11y.updateNavigation(); 7466 }, 7467 toEdge: function toEdge() { 7468 var swiper = this; 7469 if (!swiper.params.a11y.enabled) { return; } 7470 swiper.a11y.updateNavigation(); 7471 }, 7472 fromEdge: function fromEdge() { 7473 var swiper = this; 7474 if (!swiper.params.a11y.enabled) { return; } 7475 swiper.a11y.updateNavigation(); 7476 }, 7477 paginationUpdate: function paginationUpdate() { 7478 var swiper = this; 7479 if (!swiper.params.a11y.enabled) { return; } 7480 swiper.a11y.updatePagination(); 7481 }, 7482 destroy: function destroy() { 7483 var swiper = this; 7484 if (!swiper.params.a11y.enabled) { return; } 7485 swiper.a11y.destroy(); 7486 }, 7487 }, 7488 }; 7489 7490 var History = { 7491 init: function init() { 7492 var swiper = this; 7493 if (!swiper.params.history) { return; } 7494 if (!win.history || !win.history.pushState) { 7495 swiper.params.history.enabled = false; 7496 swiper.params.hashNavigation.enabled = true; 7497 return; 7498 } 7499 var history = swiper.history; 7500 history.initialized = true; 7501 history.paths = History.getPathValues(); 7502 if (!history.paths.key && !history.paths.value) { return; } 7503 history.scrollToSlide(0, history.paths.value, swiper.params.runCallbacksOnInit); 7504 if (!swiper.params.history.replaceState) { 7505 win.addEventListener('popstate', swiper.history.setHistoryPopState); 7506 } 7507 }, 7508 destroy: function destroy() { 7509 var swiper = this; 7510 if (!swiper.params.history.replaceState) { 7511 win.removeEventListener('popstate', swiper.history.setHistoryPopState); 7512 } 7513 }, 7514 setHistoryPopState: function setHistoryPopState() { 7515 var swiper = this; 7516 swiper.history.paths = History.getPathValues(); 7517 swiper.history.scrollToSlide(swiper.params.speed, swiper.history.paths.value, false); 7518 }, 7519 getPathValues: function getPathValues() { 7520 var pathArray = win.location.pathname.slice(1).split('/').filter(function (part) { return part !== ''; }); 7521 var total = pathArray.length; 7522 var key = pathArray[total - 2]; 7523 var value = pathArray[total - 1]; 7524 return { key: key, value: value }; 7525 }, 7526 setHistory: function setHistory(key, index) { 7527 var swiper = this; 7528 if (!swiper.history.initialized || !swiper.params.history.enabled) { return; } 7529 var slide = swiper.slides.eq(index); 7530 var value = History.slugify(slide.attr('data-history')); 7531 if (!win.location.pathname.includes(key)) { 7532 value = key + "/" + value; 7533 } 7534 var currentState = win.history.state; 7535 if (currentState && currentState.value === value) { 7536 return; 7537 } 7538 if (swiper.params.history.replaceState) { 7539 win.history.replaceState({ value: value }, null, value); 7540 } else { 7541 win.history.pushState({ value: value }, null, value); 7542 } 7543 }, 7544 slugify: function slugify(text) { 7545 return text.toString() 7546 .replace(/\s+/g, '-') 7547 .replace(/[^\w-]+/g, '') 7548 .replace(/--+/g, '-') 7549 .replace(/^-+/, '') 7550 .replace(/-+$/, ''); 7551 }, 7552 scrollToSlide: function scrollToSlide(speed, value, runCallbacks) { 7553 var swiper = this; 7554 if (value) { 7555 for (var i = 0, length = swiper.slides.length; i < length; i += 1) { 7556 var slide = swiper.slides.eq(i); 7557 var slideHistory = History.slugify(slide.attr('data-history')); 7558 if (slideHistory === value && !slide.hasClass(swiper.params.slideDuplicateClass)) { 7559 var index = slide.index(); 7560 swiper.slideTo(index, speed, runCallbacks); 7561 } 7562 } 7563 } else { 7564 swiper.slideTo(0, speed, runCallbacks); 7565 } 7566 }, 7567 }; 7568 7569 var History$1 = { 7570 name: 'history', 7571 params: { 7572 history: { 7573 enabled: false, 7574 replaceState: false, 7575 key: 'slides', 7576 }, 7577 }, 7578 create: function create() { 7579 var swiper = this; 7580 Utils.extend(swiper, { 7581 history: { 7582 init: History.init.bind(swiper), 7583 setHistory: History.setHistory.bind(swiper), 7584 setHistoryPopState: History.setHistoryPopState.bind(swiper), 7585 scrollToSlide: History.scrollToSlide.bind(swiper), 7586 destroy: History.destroy.bind(swiper), 7587 }, 7588 }); 7589 }, 7590 on: { 7591 init: function init() { 7592 var swiper = this; 7593 if (swiper.params.history.enabled) { 7594 swiper.history.init(); 7595 } 7596 }, 7597 destroy: function destroy() { 7598 var swiper = this; 7599 if (swiper.params.history.enabled) { 7600 swiper.history.destroy(); 7601 } 7602 }, 7603 transitionEnd: function transitionEnd() { 7604 var swiper = this; 7605 if (swiper.history.initialized) { 7606 swiper.history.setHistory(swiper.params.history.key, swiper.activeIndex); 7607 } 7608 }, 7609
vendor: 9,911 bytes, lines 7609-7881
7609 slideChange: function slideChange() { 7610 var swiper = this; 7611 if (swiper.history.initialized && swiper.params.cssMode) { 7612 swiper.history.setHistory(swiper.params.history.key, swiper.activeIndex); 7613 } 7614 }, 7615 }, 7616 }; 7617 7618 var HashNavigation = { 7619 onHashCange: function onHashCange() { 7620 var swiper = this; 7621 var newHash = doc.location.hash.replace('#', ''); 7622 var activeSlideHash = swiper.slides.eq(swiper.activeIndex).attr('data-hash'); 7623 if (newHash !== activeSlideHash) { 7624 var newIndex = swiper.$wrapperEl.children(("." + (swiper.params.slideClass) + "[data-hash=\"" + newHash + "\"]")).index(); 7625 if (typeof newIndex === 'undefined') { return; } 7626 swiper.slideTo(newIndex); 7627 } 7628 }, 7629 setHash: function setHash() { 7630 var swiper = this; 7631 if (!swiper.hashNavigation.initialized || !swiper.params.hashNavigation.enabled) { return; } 7632 if (swiper.params.hashNavigation.replaceState && win.history && win.history.replaceState) { 7633 win.history.replaceState(null, null, (("#" + (swiper.slides.eq(swiper.activeIndex).attr('data-hash'))) || '')); 7634 } else { 7635 var slide = swiper.slides.eq(swiper.activeIndex); 7636 var hash = slide.attr('data-hash') || slide.attr('data-history'); 7637 doc.location.hash = hash || ''; 7638 } 7639 }, 7640 init: function init() { 7641 var swiper = this; 7642 if (!swiper.params.hashNavigation.enabled || (swiper.params.history && swiper.params.history.enabled)) { return; } 7643 swiper.hashNavigation.initialized = true; 7644 var hash = doc.location.hash.replace('#', ''); 7645 if (hash) { 7646 var speed = 0; 7647 for (var i = 0, length = swiper.slides.length; i < length; i += 1) { 7648 var slide = swiper.slides.eq(i); 7649 var slideHash = slide.attr('data-hash') || slide.attr('data-history'); 7650 if (slideHash === hash && !slide.hasClass(swiper.params.slideDuplicateClass)) { 7651 var index = slide.index(); 7652 swiper.slideTo(index, speed, swiper.params.runCallbacksOnInit, true); 7653 } 7654 } 7655 } 7656 if (swiper.params.hashNavigation.watchState) { 7657 $(win).on('hashchange', swiper.hashNavigation.onHashCange); 7658 } 7659 }, 7660 destroy: function destroy() { 7661 var swiper = this; 7662 if (swiper.params.hashNavigation.watchState) { 7663 $(win).off('hashchange', swiper.hashNavigation.onHashCange); 7664 } 7665 }, 7666 }; 7667 var HashNavigation$1 = { 7668 name: 'hash-navigation', 7669 params: { 7670 hashNavigation: { 7671 enabled: false, 7672 replaceState: false, 7673 watchState: false, 7674 }, 7675 }, 7676 create: function create() { 7677 var swiper = this; 7678 Utils.extend(swiper, { 7679 hashNavigation: { 7680 initialized: false, 7681 init: HashNavigation.init.bind(swiper), 7682 destroy: HashNavigation.destroy.bind(swiper), 7683 setHash: HashNavigation.setHash.bind(swiper), 7684 onHashCange: HashNavigation.onHashCange.bind(swiper), 7685 }, 7686 }); 7687 }, 7688 on: { 7689 init: function init() { 7690 var swiper = this; 7691 if (swiper.params.hashNavigation.enabled) { 7692 swiper.hashNavigation.init(); 7693 } 7694 }, 7695 destroy: function destroy() { 7696 var swiper = this; 7697 if (swiper.params.hashNavigation.enabled) { 7698 swiper.hashNavigation.destroy(); 7699 } 7700 }, 7701 transitionEnd: function transitionEnd() { 7702 var swiper = this; 7703 if (swiper.hashNavigation.initialized) { 7704 swiper.hashNavigation.setHash(); 7705 } 7706 }, 7707 slideChange: function slideChange() { 7708 var swiper = this; 7709 if (swiper.hashNavigation.initialized && swiper.params.cssMode) { 7710 swiper.hashNavigation.setHash(); 7711 } 7712 }, 7713 }, 7714 }; 7715 7716 /* eslint no-underscore-dangle: "off" */ 7717 7718 var Autoplay = { 7719 run: function run() { 7720 var swiper = this; 7721 var $activeSlideEl = swiper.slides.eq(swiper.activeIndex); 7722 var delay = swiper.params.autoplay.delay; 7723 if ($activeSlideEl.attr('data-swiper-autoplay')) { 7724 delay = $activeSlideEl.attr('data-swiper-autoplay') || swiper.params.autoplay.delay; 7725 } 7726 clearTimeout(swiper.autoplay.timeout); 7727 swiper.autoplay.timeout = Utils.nextTick(function () { 7728 if (swiper.params.autoplay.reverseDirection) { 7729 if (swiper.params.loop) { 7730 swiper.loopFix(); 7731 swiper.slidePrev(swiper.params.speed, true, true); 7732 swiper.emit('autoplay'); 7733 } else if (!swiper.isBeginning) { 7734 swiper.slidePrev(swiper.params.speed, true, true); 7735 swiper.emit('autoplay'); 7736 } else if (!swiper.params.autoplay.stopOnLastSlide) { 7737 swiper.slideTo(swiper.slides.length - 1, swiper.params.speed, true, true); 7738 swiper.emit('autoplay'); 7739 } else { 7740 swiper.autoplay.stop(); 7741 } 7742 } else if (swiper.params.loop) { 7743 swiper.loopFix(); 7744 swiper.slideNext(swiper.params.speed, true, true); 7745 swiper.emit('autoplay'); 7746 } else if (!swiper.isEnd) { 7747 swiper.slideNext(swiper.params.speed, true, true); 7748 swiper.emit('autoplay'); 7749 } else if (!swiper.params.autoplay.stopOnLastSlide) { 7750 swiper.slideTo(0, swiper.params.speed, true, true); 7751 swiper.emit('autoplay'); 7752 } else { 7753 swiper.autoplay.stop(); 7754 } 7755 if (swiper.params.cssMode && swiper.autoplay.running) { swiper.autoplay.run(); } 7756 }, delay); 7757 }, 7758 start: function start() { 7759 var swiper = this; 7760 if (typeof swiper.autoplay.timeout !== 'undefined') { return false; } 7761 if (swiper.autoplay.running) { return false; } 7762 swiper.autoplay.running = true; 7763 swiper.emit('autoplayStart'); 7764 swiper.autoplay.run(); 7765 return true; 7766 }, 7767 stop: function stop() { 7768 var swiper = this; 7769 if (!swiper.autoplay.running) { return false; } 7770 if (typeof swiper.autoplay.timeout === 'undefined') { return false; } 7771 7772 if (swiper.autoplay.timeout) { 7773 clearTimeout(swiper.autoplay.timeout); 7774 swiper.autoplay.timeout = undefined; 7775 } 7776 swiper.autoplay.running = false; 7777 swiper.emit('autoplayStop'); 7778 return true; 7779 }, 7780 pause: function pause(speed) { 7781 var swiper = this; 7782 if (!swiper.autoplay.running) { return; } 7783 if (swiper.autoplay.paused) { return; } 7784 if (swiper.autoplay.timeout) { clearTimeout(swiper.autoplay.timeout); } 7785 swiper.autoplay.paused = true; 7786 if (speed === 0 || !swiper.params.autoplay.waitForTransition) { 7787 swiper.autoplay.paused = false; 7788 swiper.autoplay.run(); 7789 } else { 7790 swiper.$wrapperEl[0].addEventListener('transitionend', swiper.autoplay.onTransitionEnd); 7791 swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.autoplay.onTransitionEnd); 7792 } 7793 }, 7794 }; 7795 7796 var Autoplay$1 = { 7797 name: 'autoplay', 7798 params: { 7799 autoplay: { 7800 enabled: false, 7801 delay: 3000, 7802 waitForTransition: true, 7803 disableOnInteraction: true, 7804 stopOnLastSlide: false, 7805 reverseDirection: false, 7806 }, 7807 }, 7808 create: function create() { 7809 var swiper = this; 7810 Utils.extend(swiper, { 7811 autoplay: { 7812 running: false, 7813 paused: false, 7814 run: Autoplay.run.bind(swiper), 7815 start: Autoplay.start.bind(swiper), 7816 stop: Autoplay.stop.bind(swiper), 7817 pause: Autoplay.pause.bind(swiper), 7818 onVisibilityChange: function onVisibilityChange() { 7819 if (document.visibilityState === 'hidden' && swiper.autoplay.running) { 7820 swiper.autoplay.pause(); 7821 } 7822 if (document.visibilityState === 'visible' && swiper.autoplay.paused) { 7823 swiper.autoplay.run(); 7824 swiper.autoplay.paused = false; 7825 } 7826 }, 7827 onTransitionEnd: function onTransitionEnd(e) { 7828 if (!swiper || swiper.destroyed || !swiper.$wrapperEl) { return; } 7829 if (e.target !== this) { return; } 7830 swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.autoplay.onTransitionEnd); 7831 swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.autoplay.onTransitionEnd); 7832 swiper.autoplay.paused = false; 7833 if (!swiper.autoplay.running) { 7834 swiper.autoplay.stop(); 7835 } else { 7836 swiper.autoplay.run(); 7837 } 7838 }, 7839 }, 7840 }); 7841 }, 7842 on: { 7843 init: function init() { 7844 var swiper = this; 7845 if (swiper.params.autoplay.enabled) { 7846 swiper.autoplay.start(); 7847 document.addEventListener('visibilitychange', swiper.autoplay.onVisibilityChange); 7848 } 7849 }, 7850 beforeTransitionStart: function beforeTransitionStart(speed, internal) { 7851 var swiper = this; 7852 if (swiper.autoplay.running) { 7853 if (internal || !swiper.params.autoplay.disableOnInteraction) { 7854 swiper.autoplay.pause(speed); 7855 } else { 7856 swiper.autoplay.stop(); 7857 } 7858 } 7859 }, 7860 sliderFirstMove: function sliderFirstMove() { 7861 var swiper = this; 7862 if (swiper.autoplay.running) { 7863 if (swiper.params.autoplay.disableOnInteraction) { 7864 swiper.autoplay.stop(); 7865 } else { 7866 swiper.autoplay.pause(); 7867 } 7868 } 7869 }, 7870 touchEnd: function touchEnd() { 7871 var swiper = this; 7872 if (swiper.params.cssMode && swiper.autoplay.paused && !swiper.params.autoplay.disableOnInteraction) { 7873 swiper.autoplay.run(); 7874 } 7875 }, 7876 destroy: function destroy() { 7877 var swiper = this; 7878 if (swiper.autoplay.running) { 7879 swiper.autoplay.stop(); 7880 } 7881 document.removeEventListener('visibilitychange', swiper.autoplay.onVisibilityChange);
vendor: 25,142 bytes, lines 7881-8505
7881 7882 }, 7883 }, 7884 }; 7885 7886 var Fade = { 7887 setTranslate: function setTranslate() { 7888 var swiper = this; 7889 var slides = swiper.slides; 7890 for (var i = 0; i < slides.length; i += 1) { 7891 var $slideEl = swiper.slides.eq(i); 7892 var offset = $slideEl[0].swiperSlideOffset; 7893 var tx = -offset; 7894 if (!swiper.params.virtualTranslate) { tx -= swiper.translate; } 7895 var ty = 0; 7896 if (!swiper.isHorizontal()) { 7897 ty = tx; 7898 tx = 0; 7899 } 7900 var slideOpacity = swiper.params.fadeEffect.crossFade 7901 ? Math.max(1 - Math.abs($slideEl[0].progress), 0) 7902 : 1 + Math.min(Math.max($slideEl[0].progress, -1), 0); 7903 $slideEl 7904 .css({ 7905 opacity: slideOpacity, 7906 }) 7907 .transform(("translate3d(" + tx + "px, " + ty + "px, 0px)")); 7908 } 7909 }, 7910 setTransition: function setTransition(duration) { 7911 var swiper = this; 7912 var slides = swiper.slides; 7913 var $wrapperEl = swiper.$wrapperEl; 7914 slides.transition(duration); 7915 if (swiper.params.virtualTranslate && duration !== 0) { 7916 var eventTriggered = false; 7917 slides.transitionEnd(function () { 7918 if (eventTriggered) { return; } 7919 if (!swiper || swiper.destroyed) { return; } 7920 eventTriggered = true; 7921 swiper.animating = false; 7922 var triggerEvents = ['webkitTransitionEnd', 'transitionend']; 7923 for (var i = 0; i < triggerEvents.length; i += 1) { 7924 $wrapperEl.trigger(triggerEvents[i]); 7925 } 7926 }); 7927 } 7928 }, 7929 }; 7930 7931 var EffectFade = { 7932 name: 'effect-fade', 7933 params: { 7934 fadeEffect: { 7935 crossFade: false, 7936 }, 7937 }, 7938 create: function create() { 7939 var swiper = this; 7940 Utils.extend(swiper, { 7941 fadeEffect: { 7942 setTranslate: Fade.setTranslate.bind(swiper), 7943 setTransition: Fade.setTransition.bind(swiper), 7944 }, 7945 }); 7946 }, 7947 on: { 7948 beforeInit: function beforeInit() { 7949 var swiper = this; 7950 if (swiper.params.effect !== 'fade') { return; } 7951 swiper.classNames.push(((swiper.params.containerModifierClass) + "fade")); 7952 var overwriteParams = { 7953 slidesPerView: 1, 7954 slidesPerColumn: 1, 7955 slidesPerGroup: 1, 7956 watchSlidesProgress: true, 7957 spaceBetween: 0, 7958 virtualTranslate: true, 7959 }; 7960 Utils.extend(swiper.params, overwriteParams); 7961 Utils.extend(swiper.originalParams, overwriteParams); 7962 }, 7963 setTranslate: function setTranslate() { 7964 var swiper = this; 7965 if (swiper.params.effect !== 'fade') { return; } 7966 swiper.fadeEffect.setTranslate(); 7967 }, 7968 setTransition: function setTransition(duration) { 7969 var swiper = this; 7970 if (swiper.params.effect !== 'fade') { return; } 7971 swiper.fadeEffect.setTransition(duration); 7972 }, 7973 }, 7974 }; 7975 7976 var Cube = { 7977 setTranslate: function setTranslate() { 7978 var swiper = this; 7979 var $el = swiper.$el; 7980 var $wrapperEl = swiper.$wrapperEl; 7981 var slides = swiper.slides; 7982 var swiperWidth = swiper.width; 7983 var swiperHeight = swiper.height; 7984 var rtl = swiper.rtlTranslate; 7985 var swiperSize = swiper.size; 7986 var params = swiper.params.cubeEffect; 7987 var isHorizontal = swiper.isHorizontal(); 7988 var isVirtual = swiper.virtual && swiper.params.virtual.enabled; 7989 var wrapperRotate = 0; 7990 var $cubeShadowEl; 7991 if (params.shadow) { 7992 if (isHorizontal) { 7993 $cubeShadowEl = $wrapperEl.find('.swiper-cube-shadow'); 7994 if ($cubeShadowEl.length === 0) { 7995 $cubeShadowEl = $('<div class="swiper-cube-shadow"></div>'); 7996 $wrapperEl.append($cubeShadowEl); 7997 } 7998 $cubeShadowEl.css({ height: (swiperWidth + "px") }); 7999 } else { 8000 $cubeShadowEl = $el.find('.swiper-cube-shadow'); 8001 if ($cubeShadowEl.length === 0) { 8002 $cubeShadowEl = $('<div class="swiper-cube-shadow"></div>'); 8003 $el.append($cubeShadowEl); 8004 } 8005 } 8006 } 8007 for (var i = 0; i < slides.length; i += 1) { 8008 var $slideEl = slides.eq(i); 8009 var slideIndex = i; 8010 if (isVirtual) { 8011 slideIndex = parseInt($slideEl.attr('data-swiper-slide-index'), 10); 8012 } 8013 var slideAngle = slideIndex * 90; 8014 var round = Math.floor(slideAngle / 360); 8015 if (rtl) { 8016 slideAngle = -slideAngle; 8017 round = Math.floor(-slideAngle / 360); 8018 } 8019 var progress = Math.max(Math.min($slideEl[0].progress, 1), -1); 8020 var tx = 0; 8021 var ty = 0; 8022 var tz = 0; 8023 if (slideIndex % 4 === 0) { 8024 tx = -round * 4 * swiperSize; 8025 tz = 0; 8026 } else if ((slideIndex - 1) % 4 === 0) { 8027 tx = 0; 8028 tz = -round * 4 * swiperSize; 8029 } else if ((slideIndex - 2) % 4 === 0) { 8030 tx = swiperSize + (round * 4 * swiperSize); 8031 tz = swiperSize; 8032 } else if ((slideIndex - 3) % 4 === 0) { 8033 tx = -swiperSize; 8034 tz = (3 * swiperSize) + (swiperSize * 4 * round); 8035 } 8036 if (rtl) { 8037 tx = -tx; 8038 } 8039 8040 if (!isHorizontal) { 8041 ty = tx; 8042 tx = 0; 8043 } 8044 8045 var transform = "rotateX(" + (isHorizontal ? 0 : -slideAngle) + "deg) rotateY(" + (isHorizontal ? slideAngle : 0) + "deg) translate3d(" + tx + "px, " + ty + "px, " + tz + "px)"; 8046 if (progress <= 1 && progress > -1) { 8047 wrapperRotate = (slideIndex * 90) + (progress * 90); 8048 if (rtl) { wrapperRotate = (-slideIndex * 90) - (progress * 90); } 8049 } 8050 $slideEl.transform(transform); 8051 if (params.slideShadows) { 8052 // Set shadows 8053 var shadowBefore = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top'); 8054 var shadowAfter = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom'); 8055 if (shadowBefore.length === 0) { 8056 shadowBefore = $(("<div class=\"swiper-slide-shadow-" + (isHorizontal ? 'left' : 'top') + "\"></div>")); 8057 $slideEl.append(shadowBefore); 8058 } 8059 if (shadowAfter.length === 0) { 8060 shadowAfter = $(("<div class=\"swiper-slide-shadow-" + (isHorizontal ? 'right' : 'bottom') + "\"></div>")); 8061 $slideEl.append(shadowAfter); 8062 } 8063 if (shadowBefore.length) { shadowBefore[0].style.opacity = Math.max(-progress, 0); } 8064 if (shadowAfter.length) { shadowAfter[0].style.opacity = Math.max(progress, 0); } 8065 } 8066 } 8067 $wrapperEl.css({ 8068 '-webkit-transform-origin': ("50% 50% -" + (swiperSize / 2) + "px"), 8069 '-moz-transform-origin': ("50% 50% -" + (swiperSize / 2) + "px"), 8070 '-ms-transform-origin': ("50% 50% -" + (swiperSize / 2) + "px"), 8071 'transform-origin': ("50% 50% -" + (swiperSize / 2) + "px"), 8072 }); 8073 8074 if (params.shadow) { 8075 if (isHorizontal) { 8076 $cubeShadowEl.transform(("translate3d(0px, " + ((swiperWidth / 2) + params.shadowOffset) + "px, " + (-swiperWidth / 2) + "px) rotateX(90deg) rotateZ(0deg) scale(" + (params.shadowScale) + ")")); 8077 } else { 8078 var shadowAngle = Math.abs(wrapperRotate) - (Math.floor(Math.abs(wrapperRotate) / 90) * 90); 8079 var multiplier = 1.5 - ( 8080 (Math.sin((shadowAngle * 2 * Math.PI) / 360) / 2) 8081 + (Math.cos((shadowAngle * 2 * Math.PI) / 360) / 2) 8082 ); 8083 var scale1 = params.shadowScale; 8084 var scale2 = params.shadowScale / multiplier; 8085 var offset = params.shadowOffset; 8086 $cubeShadowEl.transform(("scale3d(" + scale1 + ", 1, " + scale2 + ") translate3d(0px, " + ((swiperHeight / 2) + offset) + "px, " + (-swiperHeight / 2 / scale2) + "px) rotateX(-90deg)")); 8087 } 8088 } 8089 var zFactor = (Browser.isSafari || Browser.isUiWebView) ? (-swiperSize / 2) : 0; 8090 $wrapperEl 8091 .transform(("translate3d(0px,0," + zFactor + "px) rotateX(" + (swiper.isHorizontal() ? 0 : wrapperRotate) + "deg) rotateY(" + (swiper.isHorizontal() ? -wrapperRotate : 0) + "deg)")); 8092 }, 8093 setTransition: function setTransition(duration) { 8094 var swiper = this; 8095 var $el = swiper.$el; 8096 var slides = swiper.slides; 8097 slides 8098 .transition(duration) 8099 .find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left') 8100 .transition(duration); 8101 if (swiper.params.cubeEffect.shadow && !swiper.isHorizontal()) { 8102 $el.find('.swiper-cube-shadow').transition(duration); 8103 } 8104 }, 8105 }; 8106 8107 var EffectCube = { 8108 name: 'effect-cube', 8109 params: { 8110 cubeEffect: { 8111 slideShadows: true, 8112 shadow: true, 8113 shadowOffset: 20, 8114 shadowScale: 0.94, 8115 }, 8116 }, 8117 create: function create() { 8118 var swiper = this; 8119 Utils.extend(swiper, { 8120 cubeEffect: { 8121 setTranslate: Cube.setTranslate.bind(swiper), 8122 setTransition: Cube.setTransition.bind(swiper), 8123 }, 8124 }); 8125 }, 8126 on: { 8127 beforeInit: function beforeInit() { 8128 var swiper = this; 8129 if (swiper.params.effect !== 'cube') { return; } 8130 swiper.classNames.push(((swiper.params.containerModifierClass) + "cube")); 8131 swiper.classNames.push(((swiper.params.containerModifierClass) + "3d")); 8132 var overwriteParams = { 8133 slidesPerView: 1, 8134 slidesPerColumn: 1, 8135 slidesPerGroup: 1, 8136 watchSlidesProgress: true, 8137 resistanceRatio: 0, 8138 spaceBetween: 0, 8139 centeredSlides: false, 8140 virtualTranslate: true, 8141 }; 8142 Utils.extend(swiper.params, overwriteParams); 8143 Utils.extend(swiper.originalParams, overwriteParams); 8144 }, 8145 setTranslate: function setTranslate() { 8146 var swiper = this; 8147 if (swiper.params.effect !== 'cube') { return; } 8148 swiper.cubeEffect.setTranslate(); 8149 }, 8150 setTransition: function setTransition(duration) { 8151 var swiper = this; 8152 if (swiper.params.effect !== 'cube') { return; } 8153 swiper.cubeEffect.setTransition(duration); 8154 }, 8155 }, 8156 }; 8157 8158 var Flip = { 8159 setTranslate: function setTranslate() { 8160 var swiper = this; 8161 var slides = swiper.slides; 8162 var rtl = swiper.rtlTranslate; 8163 for (var i = 0; i < slides.length; i += 1) { 8164 var $slideEl = slides.eq(i); 8165 var progress = $slideEl[0].progress; 8166 if (swiper.params.flipEffect.limitRotation) { 8167 progress = Math.max(Math.min($slideEl[0].progress, 1), -1); 8168 } 8169 var offset = $slideEl[0].swiperSlideOffset; 8170 var rotate = -180 * progress; 8171 var rotateY = rotate; 8172 var rotateX = 0; 8173 var tx = -offset; 8174 var ty = 0; 8175 if (!swiper.isHorizontal()) { 8176 ty = tx; 8177 tx = 0; 8178 rotateX = -rotateY; 8179 rotateY = 0; 8180 } else if (rtl) { 8181 rotateY = -rotateY; 8182 } 8183 8184 $slideEl[0].style.zIndex = -Math.abs(Math.round(progress)) + slides.length; 8185 8186 if (swiper.params.flipEffect.slideShadows) { 8187 // Set shadows 8188 var shadowBefore = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top'); 8189 var shadowAfter = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom'); 8190 if (shadowBefore.length === 0) { 8191 shadowBefore = $(("<div class=\"swiper-slide-shadow-" + (swiper.isHorizontal() ? 'left' : 'top') + "\"></div>")); 8192 $slideEl.append(shadowBefore); 8193 } 8194 if (shadowAfter.length === 0) { 8195 shadowAfter = $(("<div class=\"swiper-slide-shadow-" + (swiper.isHorizontal() ? 'right' : 'bottom') + "\"></div>")); 8196 $slideEl.append(shadowAfter); 8197 } 8198 if (shadowBefore.length) { shadowBefore[0].style.opacity = Math.max(-progress, 0); } 8199 if (shadowAfter.length) { shadowAfter[0].style.opacity = Math.max(progress, 0); } 8200 } 8201 $slideEl 8202 .transform(("translate3d(" + tx + "px, " + ty + "px, 0px) rotateX(" + rotateX + "deg) rotateY(" + rotateY + "deg)")); 8203 } 8204 }, 8205 setTransition: function setTransition(duration) { 8206 var swiper = this; 8207 var slides = swiper.slides; 8208 var activeIndex = swiper.activeIndex; 8209 var $wrapperEl = swiper.$wrapperEl; 8210 slides 8211 .transition(duration) 8212 .find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left') 8213 .transition(duration); 8214 if (swiper.params.virtualTranslate && duration !== 0) { 8215 var eventTriggered = false; 8216 // eslint-disable-next-line 8217 slides.eq(activeIndex).transitionEnd(function onTransitionEnd() { 8218 if (eventTriggered) { return; } 8219 if (!swiper || swiper.destroyed) { return; } 8220 // if (!$(this).hasClass(swiper.params.slideActiveClass)) return; 8221 eventTriggered = true; 8222 swiper.animating = false; 8223 var triggerEvents = ['webkitTransitionEnd', 'transitionend']; 8224 for (var i = 0; i < triggerEvents.length; i += 1) { 8225 $wrapperEl.trigger(triggerEvents[i]); 8226 } 8227 }); 8228 } 8229 }, 8230 }; 8231 8232 var EffectFlip = { 8233 name: 'effect-flip', 8234 params: { 8235 flipEffect: { 8236 slideShadows: true, 8237 limitRotation: true, 8238 }, 8239 }, 8240 create: function create() { 8241 var swiper = this; 8242 Utils.extend(swiper, { 8243 flipEffect: { 8244 setTranslate: Flip.setTranslate.bind(swiper), 8245 setTransition: Flip.setTransition.bind(swiper), 8246 }, 8247 }); 8248 }, 8249 on: { 8250 beforeInit: function beforeInit() { 8251 var swiper = this; 8252 if (swiper.params.effect !== 'flip') { return; } 8253 swiper.classNames.push(((swiper.params.containerModifierClass) + "flip")); 8254 swiper.classNames.push(((swiper.params.containerModifierClass) + "3d")); 8255 var overwriteParams = { 8256 slidesPerView: 1, 8257 slidesPerColumn: 1, 8258 slidesPerGroup: 1, 8259 watchSlidesProgress: true, 8260 spaceBetween: 0, 8261 virtualTranslate: true, 8262 }; 8263 Utils.extend(swiper.params, overwriteParams); 8264 Utils.extend(swiper.originalParams, overwriteParams); 8265 }, 8266 setTranslate: function setTranslate() { 8267 var swiper = this; 8268 if (swiper.params.effect !== 'flip') { return; } 8269 swiper.flipEffect.setTranslate(); 8270 }, 8271 setTransition: function setTransition(duration) { 8272 var swiper = this; 8273 if (swiper.params.effect !== 'flip') { return; } 8274 swiper.flipEffect.setTransition(duration); 8275 }, 8276 }, 8277 }; 8278 8279 var Coverflow = { 8280 setTranslate: function setTranslate() { 8281 var swiper = this; 8282 var swiperWidth = swiper.width; 8283 var swiperHeight = swiper.height; 8284 var slides = swiper.slides; 8285 var $wrapperEl = swiper.$wrapperEl; 8286 var slidesSizesGrid = swiper.slidesSizesGrid; 8287 var params = swiper.params.coverflowEffect; 8288 var isHorizontal = swiper.isHorizontal(); 8289 var transform = swiper.translate; 8290 var center = isHorizontal ? -transform + (swiperWidth / 2) : -transform + (swiperHeight / 2); 8291 var rotate = isHorizontal ? params.rotate : -params.rotate; 8292 var translate = params.depth; 8293 // Each slide offset from center 8294 for (var i = 0, length = slides.length; i < length; i += 1) { 8295 var $slideEl = slides.eq(i); 8296 var slideSize = slidesSizesGrid[i]; 8297 var slideOffset = $slideEl[0].swiperSlideOffset; 8298 var offsetMultiplier = ((center - slideOffset - (slideSize / 2)) / slideSize) * params.modifier; 8299 8300 var rotateY = isHorizontal ? rotate * offsetMultiplier : 0; 8301 var rotateX = isHorizontal ? 0 : rotate * offsetMultiplier; 8302 // var rotateZ = 0 8303 var translateZ = -translate * Math.abs(offsetMultiplier); 8304 8305 var translateY = isHorizontal ? 0 : params.stretch * (offsetMultiplier); 8306 var translateX = isHorizontal ? params.stretch * (offsetMultiplier) : 0; 8307 8308 // Fix for ultra small values 8309 if (Math.abs(translateX) < 0.001) { translateX = 0; } 8310 if (Math.abs(translateY) < 0.001) { translateY = 0; } 8311 if (Math.abs(translateZ) < 0.001) { translateZ = 0; } 8312 if (Math.abs(rotateY) < 0.001) { rotateY = 0; } 8313 if (Math.abs(rotateX) < 0.001) { rotateX = 0; } 8314 8315 var slideTransform = "translate3d(" + translateX + "px," + translateY + "px," + translateZ + "px) rotateX(" + rotateX + "deg) rotateY(" + rotateY + "deg)"; 8316 8317 $slideEl.transform(slideTransform); 8318 $slideEl[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1; 8319 if (params.slideShadows) { 8320 // Set shadows 8321 var $shadowBeforeEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top'); 8322 var $shadowAfterEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom'); 8323 if ($shadowBeforeEl.length === 0) { 8324 $shadowBeforeEl = $(("<div class=\"swiper-slide-shadow-" + (isHorizontal ? 'left' : 'top') + "\"></div>")); 8325 $slideEl.append($shadowBeforeEl); 8326 } 8327 if ($shadowAfterEl.length === 0) { 8328 $shadowAfterEl = $(("<div class=\"swiper-slide-shadow-" + (isHorizontal ? 'right' : 'bottom') + "\"></div>")); 8329 $slideEl.append($shadowAfterEl); 8330 } 8331 if ($shadowBeforeEl.length) { $shadowBeforeEl[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0; } 8332 if ($shadowAfterEl.length) { $shadowAfterEl[0].style.opacity = (-offsetMultiplier) > 0 ? -offsetMultiplier : 0; } 8333 } 8334 } 8335 8336 // Set correct perspective for IE10 8337 if (Support.pointerEvents || Support.prefixedPointerEvents) { 8338 var ws = $wrapperEl[0].style; 8339 ws.perspectiveOrigin = center + "px 50%"; 8340 } 8341 }, 8342 setTransition: function setTransition(duration) { 8343 var swiper = this; 8344 swiper.slides 8345 .transition(duration) 8346 .find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left') 8347 .transition(duration); 8348 }, 8349 }; 8350 8351 var EffectCoverflow = { 8352 name: 'effect-coverflow', 8353 params: { 8354 coverflowEffect: { 8355 rotate: 50, 8356 stretch: 0, 8357 depth: 100, 8358 modifier: 1, 8359 slideShadows: true, 8360 }, 8361 }, 8362 create: function create() { 8363 var swiper = this; 8364 Utils.extend(swiper, { 8365 coverflowEffect: { 8366 setTranslate: Coverflow.setTranslate.bind(swiper), 8367 setTransition: Coverflow.setTransition.bind(swiper), 8368 }, 8369 }); 8370 }, 8371 on: { 8372 beforeInit: function beforeInit() { 8373 var swiper = this; 8374 if (swiper.params.effect !== 'coverflow') { return; } 8375 8376 swiper.classNames.push(((swiper.params.containerModifierClass) + "coverflow")); 8377 swiper.classNames.push(((swiper.params.containerModifierClass) + "3d")); 8378 8379 swiper.params.watchSlidesProgress = true; 8380 swiper.originalParams.watchSlidesProgress = true; 8381 }, 8382 setTranslate: function setTranslate() { 8383 var swiper = this; 8384 if (swiper.params.effect !== 'coverflow') { return; } 8385 swiper.coverflowEffect.setTranslate(); 8386 }, 8387 setTransition: function setTransition(duration) { 8388 var swiper = this; 8389 if (swiper.params.effect !== 'coverflow') { return; } 8390 swiper.coverflowEffect.setTransition(duration); 8391 }, 8392 }, 8393 }; 8394 8395 var Thumbs = { 8396 init: function init() { 8397 var swiper = this; 8398 var ref = swiper.params; 8399 var thumbsParams = ref.thumbs; 8400 var SwiperClass = swiper.constructor; 8401 if (thumbsParams.swiper instanceof SwiperClass) { 8402 swiper.thumbs.swiper = thumbsParams.swiper; 8403 Utils.extend(swiper.thumbs.swiper.originalParams, { 8404 watchSlidesProgress: true, 8405 slideToClickedSlide: false, 8406 }); 8407 Utils.extend(swiper.thumbs.swiper.params, { 8408 watchSlidesProgress: true, 8409 slideToClickedSlide: false, 8410 }); 8411 } else if (Utils.isObject(thumbsParams.swiper)) { 8412 swiper.thumbs.swiper = new SwiperClass(Utils.extend({}, thumbsParams.swiper, { 8413 watchSlidesVisibility: true, 8414 watchSlidesProgress: true, 8415 slideToClickedSlide: false, 8416 })); 8417 swiper.thumbs.swiperCreated = true; 8418 } 8419 swiper.thumbs.swiper.$el.addClass(swiper.params.thumbs.thumbsContainerClass); 8420 swiper.thumbs.swiper.on('tap', swiper.thumbs.onThumbClick); 8421 }, 8422 onThumbClick: function onThumbClick() { 8423 var swiper = this; 8424 var thumbsSwiper = swiper.thumbs.swiper; 8425 if (!thumbsSwiper) { return; } 8426 var clickedIndex = thumbsSwiper.clickedIndex; 8427 var clickedSlide = thumbsSwiper.clickedSlide; 8428 if (clickedSlide && $(clickedSlide).hasClass(swiper.params.thumbs.slideThumbActiveClass)) { return; } 8429 if (typeof clickedIndex === 'undefined' || clickedIndex === null) { return; } 8430 var slideToIndex; 8431 if (thumbsSwiper.params.loop) { 8432 slideToIndex = parseInt($(thumbsSwiper.clickedSlide).attr('data-swiper-slide-index'), 10); 8433 } else { 8434 slideToIndex = clickedIndex; 8435 } 8436 if (swiper.params.loop) { 8437 var currentIndex = swiper.activeIndex; 8438 if (swiper.slides.eq(currentIndex).hasClass(swiper.params.slideDuplicateClass)) { 8439 swiper.loopFix(); 8440 // eslint-disable-next-line 8441 swiper._clientLeft = swiper.$wrapperEl[0].clientLeft; 8442 currentIndex = swiper.activeIndex; 8443 } 8444 var prevIndex = swiper.slides.eq(currentIndex).prevAll(("[data-swiper-slide-index=\"" + slideToIndex + "\"]")).eq(0).index(); 8445 var nextIndex = swiper.slides.eq(currentIndex).nextAll(("[data-swiper-slide-index=\"" + slideToIndex + "\"]")).eq(0).index(); 8446 if (typeof prevIndex === 'undefined') { slideToIndex = nextIndex; } 8447 else if (typeof nextIndex === 'undefined') { slideToIndex = prevIndex; } 8448 else if (nextIndex - currentIndex < currentIndex - prevIndex) { slideToIndex = nextIndex; } 8449 else { slideToIndex = prevIndex; } 8450 } 8451 swiper.slideTo(slideToIndex); 8452 }, 8453 update: function update(initial) { 8454 var swiper = this; 8455 var thumbsSwiper = swiper.thumbs.swiper; 8456 if (!thumbsSwiper) { return; } 8457 8458 var slidesPerView = thumbsSwiper.params.slidesPerView === 'auto' 8459 ? thumbsSwiper.slidesPerViewDynamic() 8460 : thumbsSwiper.params.slidesPerView; 8461 8462 if (swiper.realIndex !== thumbsSwiper.realIndex) { 8463 var currentThumbsIndex = thumbsSwiper.activeIndex; 8464 var newThumbsIndex; 8465 if (thumbsSwiper.params.loop) { 8466 if (thumbsSwiper.slides.eq(currentThumbsIndex).hasClass(thumbsSwiper.params.slideDuplicateClass)) { 8467 thumbsSwiper.loopFix(); 8468 // eslint-disable-next-line 8469 thumbsSwiper._clientLeft = thumbsSwiper.$wrapperEl[0].clientLeft; 8470 currentThumbsIndex = thumbsSwiper.activeIndex; 8471 } 8472 // Find actual thumbs index to slide to 8473 var prevThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).prevAll(("[data-swiper-slide-index=\"" + (swiper.realIndex) + "\"]")).eq(0).index(); 8474 var nextThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).nextAll(("[data-swiper-slide-index=\"" + (swiper.realIndex) + "\"]")).eq(0).index(); 8475 if (typeof prevThumbsIndex === 'undefined') { newThumbsIndex = nextThumbsIndex; } 8476 else if (typeof nextThumbsIndex === 'undefined') { newThumbsIndex = prevThumbsIndex; } 8477 else if (nextThumbsIndex - currentThumbsIndex === currentThumbsIndex - prevThumbsIndex) { newThumbsIndex = currentThumbsIndex; } 8478 else if (nextThumbsIndex - currentThumbsIndex < currentThumbsIndex - prevThumbsIndex) { newThumbsIndex = nextThumbsIndex; } 8479 else { newThumbsIndex = prevThumbsIndex; } 8480 } else { 8481 newThumbsIndex = swiper.realIndex; 8482 } 8483 if (thumbsSwiper.visibleSlidesIndexes && thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) { 8484 if (thumbsSwiper.params.centeredSlides) { 8485 if (newThumbsIndex > currentThumbsIndex) { 8486 newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1; 8487 } else { 8488 newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1; 8489 } 8490 } else if (newThumbsIndex > currentThumbsIndex) { 8491 newThumbsIndex = newThumbsIndex - slidesPerView + 1; 8492 } 8493 thumbsSwiper.slideTo(newThumbsIndex, initial ? 0 : undefined); 8494 } 8495 } 8496 8497 // Activate thumbs 8498 var thumbsToActivate = 1; 8499 var thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass; 8500 8501 if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) { 8502 thumbsToActivate = swiper.params.slidesPerView; 8503 } 8504 8505
vendor: 3,321 bytes, lines 8505-8629
8505if (!swiper.params.thumbs.multipleActiveThumbs) { 8506 thumbsToActivate = 1; 8507 } 8508 8509 thumbsToActivate = Math.floor(thumbsToActivate); 8510 8511 thumbsSwiper.slides.removeClass(thumbActiveClass); 8512 if (thumbsSwiper.params.loop || (thumbsSwiper.params.virtual && thumbsSwiper.params.virtual.enabled)) { 8513 for (var i = 0; i < thumbsToActivate; i += 1) { 8514 thumbsSwiper.$wrapperEl.children(("[data-swiper-slide-index=\"" + (swiper.realIndex + i) + "\"]")).addClass(thumbActiveClass); 8515 } 8516 } else { 8517 for (var i$1 = 0; i$1 < thumbsToActivate; i$1 += 1) { 8518 thumbsSwiper.slides.eq(swiper.realIndex + i$1).addClass(thumbActiveClass); 8519 } 8520 } 8521 }, 8522 }; 8523 var Thumbs$1 = { 8524 name: 'thumbs', 8525 params: { 8526 thumbs: { 8527 multipleActiveThumbs: true, 8528 swiper: null, 8529 slideThumbActiveClass: 'swiper-slide-thumb-active', 8530 thumbsContainerClass: 'swiper-container-thumbs', 8531 }, 8532 }, 8533 create: function create() { 8534 var swiper = this; 8535 Utils.extend(swiper, { 8536 thumbs: { 8537 swiper: null, 8538 init: Thumbs.init.bind(swiper), 8539 update: Thumbs.update.bind(swiper), 8540 onThumbClick: Thumbs.onThumbClick.bind(swiper), 8541 }, 8542 }); 8543 }, 8544 on: { 8545 beforeInit: function beforeInit() { 8546 var swiper = this; 8547 var ref = swiper.params; 8548 var thumbs = ref.thumbs; 8549 if (!thumbs || !thumbs.swiper) { return; } 8550 swiper.thumbs.init(); 8551 swiper.thumbs.update(true); 8552 }, 8553 slideChange: function slideChange() { 8554 var swiper = this; 8555 if (!swiper.thumbs.swiper) { return; } 8556 swiper.thumbs.update(); 8557 }, 8558 update: function update() { 8559 var swiper = this; 8560 if (!swiper.thumbs.swiper) { return; } 8561 swiper.thumbs.update(); 8562 }, 8563 resize: function resize() { 8564 var swiper = this; 8565 if (!swiper.thumbs.swiper) { return; } 8566 swiper.thumbs.update(); 8567 }, 8568 observerUpdate: function observerUpdate() { 8569 var swiper = this; 8570 if (!swiper.thumbs.swiper) { return; } 8571 swiper.thumbs.update(); 8572 }, 8573 setTransition: function setTransition(duration) { 8574 var swiper = this; 8575 var thumbsSwiper = swiper.thumbs.swiper; 8576 if (!thumbsSwiper) { return; } 8577 thumbsSwiper.setTransition(duration); 8578 }, 8579 beforeDestroy: function beforeDestroy() { 8580 var swiper = this; 8581 var thumbsSwiper = swiper.thumbs.swiper; 8582 if (!thumbsSwiper) { return; } 8583 if (swiper.thumbs.swiperCreated && thumbsSwiper) { 8584 thumbsSwiper.destroy(); 8585 } 8586 }, 8587 }, 8588 }; 8589 8590 // Swiper Class 8591 8592 var components = [ 8593 Device$1, 8594 Support$1, 8595 Browser$1, 8596 Resize, 8597 Observer$1, 8598 Virtual$1, 8599 Keyboard$1, 8600 Mousewheel$1, 8601 Navigation$1, 8602 Pagination$1, 8603 Scrollbar$1, 8604 Parallax$1, 8605 Zoom$1, 8606 Lazy$1, 8607 Controller$1, 8608 A11y, 8609 History$1, 8610 HashNavigation$1, 8611 Autoplay$1, 8612 EffectFade, 8613 EffectCube, 8614 EffectFlip, 8615 EffectCoverflow, 8616 Thumbs$1 8617 ]; 8618 8619 if (typeof Swiper.use === 'undefined') { 8620 Swiper.use = Swiper.Class.use; 8621 Swiper.installModule = Swiper.Class.installModule; 8622 } 8623 8624 Swiper.use(components); 8625 8626 return Swiper; 8627 8628})); 8629//# sourceMappingURL=swiper.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.