/**
* swiper 4.0.7
* most modern mobile touch slider and framework with hardware accelerated transitions
* http://www.idangero.us/swiper/
*
* copyright 2014-2017 vladimir kharlampidi
*
* released under the mit license
*
* released on: november 28, 2017
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.swiper = factory());
}(this, (function () { 'use strict';
var w;
if (typeof window === 'undefined') {
w = {
navigator: {
useragent: '',
},
location: {},
history: {},
addeventlistener: function addeventlistener() {},
removeeventlistener: function removeeventlistener() {},
getcomputedstyle: function getcomputedstyle() {
return {};
},
image: function image() {},
date: function date() {},
screen: {},
};
} else {
w = window;
}
var win = w;
/**
* dom7 2.0.1
* minimalistic javascript library for dom manipulation, with a jquery-compatible api
* http://framework7.io/docs/dom.html
*
* copyright 2017, vladimir kharlampidi
* the idangero.us
* http://www.idangero.us/
*
* licensed under mit
*
* released on: october 2, 2017
*/
var dom7 = function dom7(arr) {
var self = this;
// create array-like object
for (var i = 0; i < arr.length; i += 1) {
self[i] = arr[i];
}
self.length = arr.length;
// return collection with methods
return this;
};
function $$1(selector, context) {
var arr = [];
var i = 0;
if (selector && !context) {
if (selector instanceof dom7) {
return selector;
}
}
if (selector) {
// string
if (typeof selector === 'string') {
var els;
var tempparent;
var html = selector.trim();
if (html.indexof('<') >= 0 && html.indexof('>') >= 0) {
var tocreate = 'div';
if (html.indexof('
:~]/)) {
// pure id selector
els = [document.getelementbyid(selector.trim().split('#')[1])];
} else {
// other selectors
els = (context || document).queryselectorall(selector.trim());
}
for (i = 0; i < els.length; i += 1) {
if (els[i]) { arr.push(els[i]); }
}
}
} else if (selector.nodetype || selector === window || selector === document) {
// node/element
arr.push(selector);
} else if (selector.length > 0 && selector[0].nodetype) {
// array of elements or instance of dom
for (i = 0; i < selector.length; i += 1) {
arr.push(selector[i]);
}
}
}
return new dom7(arr);
}
$$1.fn = dom7.prototype;
$$1.class = dom7;
$$1.dom7 = dom7;
function unique(arr) {
var uniquearray = [];
for (var i = 0; i < arr.length; i += 1) {
if (uniquearray.indexof(arr[i]) === -1) { uniquearray.push(arr[i]); }
}
return uniquearray;
}
// classes and attributes
function addclass(classname) {
var this$1 = this;
if (typeof classname === 'undefined') {
return this;
}
var classes = classname.split(' ');
for (var i = 0; i < classes.length; i += 1) {
for (var j = 0; j < this.length; j += 1) {
if (typeof this$1[j].classlist !== 'undefined') { this$1[j].classlist.add(classes[i]); }
}
}
return this;
}
function removeclass(classname) {
var this$1 = this;
var classes = classname.split(' ');
for (var i = 0; i < classes.length; i += 1) {
for (var j = 0; j < this.length; j += 1) {
if (typeof this$1[j].classlist !== 'undefined') { this$1[j].classlist.remove(classes[i]); }
}
}
return this;
}
function hasclass(classname) {
if (!this[0]) { return false; }
return this[0].classlist.contains(classname);
}
function toggleclass(classname) {
var this$1 = this;
var classes = classname.split(' ');
for (var i = 0; i < classes.length; i += 1) {
for (var j = 0; j < this.length; j += 1) {
if (typeof this$1[j].classlist !== 'undefined') { this$1[j].classlist.toggle(classes[i]); }
}
}
return this;
}
function attr(attrs, value) {
var arguments$1 = arguments;
var this$1 = this;
if (arguments.length === 1 && typeof attrs === 'string') {
// get attr
if (this[0]) { return this[0].getattribute(attrs); }
return undefined;
}
// set attrs
for (var i = 0; i < this.length; i += 1) {
if (arguments$1.length === 2) {
// string
this$1[i].setattribute(attrs, value);
} else {
// object
// eslint-disable-next-line
for (var attrname in attrs) {
this$1[i][attrname] = attrs[attrname];
this$1[i].setattribute(attrname, attrs[attrname]);
}
}
}
return this;
}
// eslint-disable-next-line
function removeattr(attr) {
var this$1 = this;
for (var i = 0; i < this.length; i += 1) {
this$1[i].removeattribute(attr);
}
return this;
}
function data(key, value) {
var this$1 = this;
var el;
if (typeof value === 'undefined') {
el = this[0];
// get value
if (el) {
if (el.dom7elementdatastorage && (key in el.dom7elementdatastorage)) {
return el.dom7elementdatastorage[key];
}
var datakey = el.getattribute(("data-" + key));
if (datakey) {
return datakey;
}
return undefined;
}
return undefined;
}
// set value
for (var i = 0; i < this.length; i += 1) {
el = this$1[i];
if (!el.dom7elementdatastorage) { el.dom7elementdatastorage = {}; }
el.dom7elementdatastorage[key] = value;
}
return this;
}
// transforms
// eslint-disable-next-line
function transform(transform) {
var this$1 = this;
for (var i = 0; i < this.length; i += 1) {
var elstyle = this$1[i].style;
elstyle.webkittransform = transform;
elstyle.transform = transform;
}
return this;
}
function transition(duration) {
var this$1 = this;
if (typeof duration !== 'string') {
duration = duration + "ms"; // eslint-disable-line
}
for (var i = 0; i < this.length; i += 1) {
var elstyle = this$1[i].style;
elstyle.webkittransitionduration = duration;
elstyle.transitionduration = duration;
}
return this;
}
// events
function on() {
var this$1 = this;
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
var eventtype = args[0];
var targetselector = args[1];
var listener = args[2];
var capture = args[3];
if (typeof args[1] === 'function') {
var assign;
(assign = args, eventtype = assign[0], listener = assign[1], capture = assign[2]);
targetselector = undefined;
}
if (!capture) { capture = false; }
function handleliveevent(e) {
var target = e.target;
if (!target) { return; }
var eventdata = e.target.dom7eventdata || [];
eventdata.unshift(e);
if ($$1(target).is(targetselector)) { listener.apply(target, eventdata); }
else {
var parents = $$1(target).parents(); // eslint-disable-line
for (var k = 0; k < parents.length; k += 1) {
if ($$1(parents[k]).is(targetselector)) { listener.apply(parents[k], eventdata); }
}
}
}
function handleevent(e) {
var eventdata = e && e.target ? e.target.dom7eventdata || [] : [];
eventdata.unshift(e);
listener.apply(this, eventdata);
}
var events = eventtype.split(' ');
var j;
for (var i = 0; i < this.length; i += 1) {
var el = this$1[i];
if (!targetselector) {
for (j = 0; j < events.length; j += 1) {
if (!el.dom7listeners) { el.dom7listeners = []; }
el.dom7listeners.push({
type: eventtype,
listener: listener,
proxylistener: handleevent,
});
el.addeventlistener(events[j], handleevent, capture);
}
} else {
// live events
for (j = 0; j < events.length; j += 1) {
if (!el.dom7livelisteners) { el.dom7livelisteners = []; }
el.dom7livelisteners.push({
type: eventtype,
listener: listener,
proxylistener: handleliveevent,
});
el.addeventlistener(events[j], handleliveevent, capture);
}
}
}
return this;
}
function off() {
var this$1 = this;
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
var eventtype = args[0];
var targetselector = args[1];
var listener = args[2];
var capture = args[3];
if (typeof args[1] === 'function') {
var assign;
(assign = args, eventtype = assign[0], listener = assign[1], capture = assign[2]);
targetselector = undefined;
}
if (!capture) { capture = false; }
var events = eventtype.split(' ');
for (var i = 0; i < events.length; i += 1) {
for (var j = 0; j < this.length; j += 1) {
var el = this$1[j];
if (!targetselector) {
if (el.dom7listeners) {
for (var k = 0; k < el.dom7listeners.length; k += 1) {
if (listener) {
if (el.dom7listeners[k].listener === listener) {
el.removeeventlistener(events[i], el.dom7listeners[k].proxylistener, capture);
}
} else if (el.dom7listeners[k].type === events[i]) {
el.removeeventlistener(events[i], el.dom7listeners[k].proxylistener, capture);
}
}
}
} else if (el.dom7livelisteners) {
for (var k$1 = 0; k$1 < el.dom7livelisteners.length; k$1 += 1) {
if (listener) {
if (el.dom7livelisteners[k$1].listener === listener) {
el.removeeventlistener(events[i], el.dom7livelisteners[k$1].proxylistener, capture);
}
} else if (el.dom7livelisteners[k$1].type === events[i]) {
el.removeeventlistener(events[i], el.dom7livelisteners[k$1].proxylistener, capture);
}
}
}
}
}
return this;
}
function trigger() {
var this$1 = this;
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
var events = args[0].split(' ');
var eventdata = args[1];
for (var i = 0; i < events.length; i += 1) {
for (var j = 0; j < this.length; j += 1) {
var evt = (void 0);
try {
evt = new window.customevent(events[i], {
detail: eventdata,
bubbles: true,
cancelable: true,
});
} catch (e) {
evt = document.createevent('event');
evt.initevent(events[i], true, true);
evt.detail = eventdata;
}
// eslint-disable-next-line
this$1[j].dom7eventdata = args.filter(function (data, dataindex) { return dataindex > 0; });
this$1[j].dispatchevent(evt);
this$1[j].dom7eventdata = [];
delete this$1[j].dom7eventdata;
}
}
return this;
}
function transitionend(callback) {
var events = ['webkittransitionend', 'transitionend'];
var dom = this;
var i;
function firecallback(e) {
/* jshint validthis:true */
if (e.target !== this) { return; }
callback.call(this, e);
for (i = 0; i < events.length; i += 1) {
dom.off(events[i], firecallback);
}
}
if (callback) {
for (i = 0; i < events.length; i += 1) {
dom.on(events[i], firecallback);
}
}
return this;
}
function outerwidth(includemargins) {
if (this.length > 0) {
if (includemargins) {
// eslint-disable-next-line
var styles = this.styles();
return this[0].offsetwidth + parsefloat(styles.getpropertyvalue('margin-right')) + parsefloat(styles.getpropertyvalue('margin-left'));
}
return this[0].offsetwidth;
}
return null;
}
function outerheight(includemargins) {
if (this.length > 0) {
if (includemargins) {
// eslint-disable-next-line
var styles = this.styles();
return this[0].offsetheight + parsefloat(styles.getpropertyvalue('margin-top')) + parsefloat(styles.getpropertyvalue('margin-bottom'));
}
return this[0].offsetheight;
}
return null;
}
function offset() {
if (this.length > 0) {
var el = this[0];
var box = el.getboundingclientrect();
var body = document.body;
var clienttop = el.clienttop || body.clienttop || 0;
var clientleft = el.clientleft || body.clientleft || 0;
var scrolltop = el === window ? window.scrolly : el.scrolltop;
var scrollleft = el === window ? window.scrollx : el.scrollleft;
return {
top: (box.top + scrolltop) - clienttop,
left: (box.left + scrollleft) - clientleft,
};
}
return null;
}
function styles() {
if (this[0]) { return window.getcomputedstyle(this[0], null); }
return {};
}
function css(props, value) {
var this$1 = this;
var i;
if (arguments.length === 1) {
if (typeof props === 'string') {
if (this[0]) { return window.getcomputedstyle(this[0], null).getpropertyvalue(props); }
} else {
for (i = 0; i < this.length; i += 1) {
// eslint-disable-next-line
for (var prop in props) {
this$1[i].style[prop] = props[prop];
}
}
return this;
}
}
if (arguments.length === 2 && typeof props === 'string') {
for (i = 0; i < this.length; i += 1) {
this$1[i].style[props] = value;
}
return this;
}
return this;
}
// iterate over the collection passing elements to `callback`
function each(callback) {
var this$1 = this;
// don't bother continuing without a callback
if (!callback) { return this; }
// iterate over the current collection
for (var i = 0; i < this.length; i += 1) {
// if the callback returns false
if (callback.call(this$1[i], i, this$1[i]) === false) {
// end the loop early
return this$1;
}
}
// return `this` to allow chained dom operations
return this;
}
// eslint-disable-next-line
function html(html) {
var this$1 = this;
if (typeof html === 'undefined') {
return this[0] ? this[0].innerhtml : undefined;
}
for (var i = 0; i < this.length; i += 1) {
this$1[i].innerhtml = html;
}
return this;
}
// eslint-disable-next-line
function text(text) {
var this$1 = this;
if (typeof text === 'undefined') {
if (this[0]) {
return this[0].textcontent.trim();
}
return null;
}
for (var i = 0; i < this.length; i += 1) {
this$1[i].textcontent = text;
}
return this;
}
function is(selector) {
var el = this[0];
var comparewith;
var i;
if (!el || typeof selector === 'undefined') { return false; }
if (typeof selector === 'string') {
if (el.matches) { return el.matches(selector); }
else if (el.webkitmatchesselector) { return el.webkitmatchesselector(selector); }
else if (el.msmatchesselector) { return el.msmatchesselector(selector); }
comparewith = $$1(selector);
for (i = 0; i < comparewith.length; i += 1) {
if (comparewith[i] === el) { return true; }
}
return false;
} else if (selector === document) { return el === document; }
else if (selector === window) { return el === window; }
if (selector.nodetype || selector instanceof dom7) {
comparewith = selector.nodetype ? [selector] : selector;
for (i = 0; i < comparewith.length; i += 1) {
if (comparewith[i] === el) { return true; }
}
return false;
}
return false;
}
function index() {
var child = this[0];
var i;
if (child) {
i = 0;
// eslint-disable-next-line
while ((child = child.previoussibling) !== null) {
if (child.nodetype === 1) { i += 1; }
}
return i;
}
return undefined;
}
// eslint-disable-next-line
function eq(index) {
if (typeof index === 'undefined') { return this; }
var length = this.length;
var returnindex;
if (index > length - 1) {
return new dom7([]);
}
if (index < 0) {
returnindex = length + index;
if (returnindex < 0) { return new dom7([]); }
return new dom7([this[returnindex]]);
}
return new dom7([this[index]]);
}
function append() {
var this$1 = this;
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
var newchild;
for (var k = 0; k < args.length; k += 1) {
newchild = args[k];
for (var i = 0; i < this.length; i += 1) {
if (typeof newchild === 'string') {
var tempdiv = document.createelement('div');
tempdiv.innerhtml = newchild;
while (tempdiv.firstchild) {
this$1[i].appendchild(tempdiv.firstchild);
}
} else if (newchild instanceof dom7) {
for (var j = 0; j < newchild.length; j += 1) {
this$1[i].appendchild(newchild[j]);
}
} else {
this$1[i].appendchild(newchild);
}
}
}
return this;
}
function prepend(newchild) {
var this$1 = this;
var i;
var j;
for (i = 0; i < this.length; i += 1) {
if (typeof newchild === 'string') {
var tempdiv = document.createelement('div');
tempdiv.innerhtml = newchild;
for (j = tempdiv.childnodes.length - 1; j >= 0; j -= 1) {
this$1[i].insertbefore(tempdiv.childnodes[j], this$1[i].childnodes[0]);
}
} else if (newchild instanceof dom7) {
for (j = 0; j < newchild.length; j += 1) {
this$1[i].insertbefore(newchild[j], this$1[i].childnodes[0]);
}
} else {
this$1[i].insertbefore(newchild, this$1[i].childnodes[0]);
}
}
return this;
}
function next(selector) {
if (this.length > 0) {
if (selector) {
if (this[0].nextelementsibling && $$1(this[0].nextelementsibling).is(selector)) {
return new dom7([this[0].nextelementsibling]);
}
return new dom7([]);
}
if (this[0].nextelementsibling) { return new dom7([this[0].nextelementsibling]); }
return new dom7([]);
}
return new dom7([]);
}
function nextall(selector) {
var nextels = [];
var el = this[0];
if (!el) { return new dom7([]); }
while (el.nextelementsibling) {
var next = el.nextelementsibling; // eslint-disable-line
if (selector) {
if ($$1(next).is(selector)) { nextels.push(next); }
} else { nextels.push(next); }
el = next;
}
return new dom7(nextels);
}
function prev(selector) {
if (this.length > 0) {
var el = this[0];
if (selector) {
if (el.previouselementsibling && $$1(el.previouselementsibling).is(selector)) {
return new dom7([el.previouselementsibling]);
}
return new dom7([]);
}
if (el.previouselementsibling) { return new dom7([el.previouselementsibling]); }
return new dom7([]);
}
return new dom7([]);
}
function prevall(selector) {
var prevels = [];
var el = this[0];
if (!el) { return new dom7([]); }
while (el.previouselementsibling) {
var prev = el.previouselementsibling; // eslint-disable-line
if (selector) {
if ($$1(prev).is(selector)) { prevels.push(prev); }
} else { prevels.push(prev); }
el = prev;
}
return new dom7(prevels);
}
function parent(selector) {
var this$1 = this;
var parents = []; // eslint-disable-line
for (var i = 0; i < this.length; i += 1) {
if (this$1[i].parentnode !== null) {
if (selector) {
if ($$1(this$1[i].parentnode).is(selector)) { parents.push(this$1[i].parentnode); }
} else {
parents.push(this$1[i].parentnode);
}
}
}
return $$1(unique(parents));
}
function parents(selector) {
var this$1 = this;
var parents = []; // eslint-disable-line
for (var i = 0; i < this.length; i += 1) {
var parent = this$1[i].parentnode; // eslint-disable-line
while (parent) {
if (selector) {
if ($$1(parent).is(selector)) { parents.push(parent); }
} else {
parents.push(parent);
}
parent = parent.parentnode;
}
}
return $$1(unique(parents));
}
function closest(selector) {
var closest = this; // eslint-disable-line
if (typeof selector === 'undefined') {
return new dom7([]);
}
if (!closest.is(selector)) {
closest = closest.parents(selector).eq(0);
}
return closest;
}
function find(selector) {
var this$1 = this;
var foundelements = [];
for (var i = 0; i < this.length; i += 1) {
var found = this$1[i].queryselectorall(selector);
for (var j = 0; j < found.length; j += 1) {
foundelements.push(found[j]);
}
}
return new dom7(foundelements);
}
function children(selector) {
var this$1 = this;
var children = []; // eslint-disable-line
for (var i = 0; i < this.length; i += 1) {
var childnodes = this$1[i].childnodes;
for (var j = 0; j < childnodes.length; j += 1) {
if (!selector) {
if (childnodes[j].nodetype === 1) { children.push(childnodes[j]); }
} else if (childnodes[j].nodetype === 1 && $$1(childnodes[j]).is(selector)) {
children.push(childnodes[j]);
}
}
}
return new dom7(unique(children));
}
function remove() {
var this$1 = this;
for (var i = 0; i < this.length; i += 1) {
if (this$1[i].parentnode) { this$1[i].parentnode.removechild(this$1[i]); }
}
return this;
}
function add() {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
var dom = this;
var i;
var j;
for (i = 0; i < args.length; i += 1) {
var toadd = $$1(args[i]);
for (j = 0; j < toadd.length; j += 1) {
dom[dom.length] = toadd[j];
dom.length += 1;
}
}
return dom;
}
var notrigger = ('resize scroll').split(' ');
var methods = {
addclass: addclass,
removeclass: removeclass,
hasclass: hasclass,
toggleclass: toggleclass,
attr: attr,
removeattr: removeattr,
data: data,
transform: transform,
transition: transition,
on: on,
off: off,
trigger: trigger,
transitionend: transitionend,
outerwidth: outerwidth,
outerheight: outerheight,
offset: offset,
css: css,
each: each,
html: html,
text: text,
is: is,
index: index,
eq: eq,
append: append,
prepend: prepend,
next: next,
nextall: nextall,
prev: prev,
prevall: prevall,
parent: parent,
parents: parents,
closest: closest,
find: find,
children: children,
remove: remove,
add: add,
styles: styles,
};
object.keys(methods).foreach(function (methodname) {
$$1.fn[methodname] = methods[methodname];
});
var utils = {
deleteprops: function deleteprops(obj) {
var object = obj;
object.keys(object).foreach(function (key) {
try {
object[key] = null;
} catch (e) {
// no getter for object
}
try {
delete object[key];
} catch (e) {
// something got wrong
}
});
},
nexttick: function nexttick(callback, delay) {
if ( delay === void 0 ) delay = 0;
return settimeout(callback, delay);
},
now: function now() {
return date.now();
},
gettranslate: function gettranslate(el, axis) {
if ( axis === void 0 ) axis = 'x';
var matrix;
var curtransform;
var transformmatrix;
var curstyle = win.getcomputedstyle(el, null);
if (win.webkitcssmatrix) {
curtransform = curstyle.transform || curstyle.webkittransform;
if (curtransform.split(',').length > 6) {
curtransform = curtransform.split(', ').map(function (a) { return a.replace(',', '.'); }).join(', ');
}
// some old versions of webkit choke when 'none' is passed; pass
// empty string instead in this case
transformmatrix = new win.webkitcssmatrix(curtransform === 'none' ? '' : curtransform);
} else {
transformmatrix = curstyle.moztransform || curstyle.otransform || curstyle.mstransform || curstyle.mstransform || curstyle.transform || curstyle.getpropertyvalue('transform').replace('translate(', 'matrix(1, 0, 0, 1,');
matrix = transformmatrix.tostring().split(',');
}
if (axis === 'x') {
// latest chrome and webkits fix
if (win.webkitcssmatrix) { curtransform = transformmatrix.m41; }
// crazy ie10 matrix
else if (matrix.length === 16) { curtransform = parsefloat(matrix[12]); }
// normal browsers
else { curtransform = parsefloat(matrix[4]); }
}
if (axis === 'y') {
// latest chrome and webkits fix
if (win.webkitcssmatrix) { curtransform = transformmatrix.m42; }
// crazy ie10 matrix
else if (matrix.length === 16) { curtransform = parsefloat(matrix[13]); }
// normal browsers
else { curtransform = parsefloat(matrix[5]); }
}
return curtransform || 0;
},
parseurlquery: function parseurlquery(url) {
var query = {};
var urltoparse = url || win.location.href;
var i;
var params;
var param;
var length;
if (typeof urltoparse === 'string' && urltoparse.length) {
urltoparse = urltoparse.indexof('?') > -1 ? urltoparse.replace(/\s*\?/, '') : '';
params = urltoparse.split('&').filter(function (paramspart) { return paramspart !== ''; });
length = params.length;
for (i = 0; i < length; i += 1) {
param = params[i].replace(/#\s+/g, '').split('=');
query[decodeuricomponent(param[0])] = typeof param[1] === 'undefined' ? undefined : decodeuricomponent(param[1]) || '';
}
}
return query;
},
isobject: function isobject(o) {
return typeof o === 'object' && o !== null && o.constructor && o.constructor === object;
},
extend: function extend() {
var args = [], len$1 = arguments.length;
while ( len$1-- ) args[ len$1 ] = arguments[ len$1 ];
var to = object(args[0]);
for (var i = 1; i < args.length; i += 1) {
var nextsource = args[i];
if (nextsource !== undefined && nextsource !== null) {
var keysarray = object.keys(object(nextsource));
for (var nextindex = 0, len = keysarray.length; nextindex < len; nextindex += 1) {
var nextkey = keysarray[nextindex];
var desc = object.getownpropertydescriptor(nextsource, nextkey);
if (desc !== undefined && desc.enumerable) {
if (utils.isobject(to[nextkey]) && utils.isobject(nextsource[nextkey])) {
utils.extend(to[nextkey], nextsource[nextkey]);
} else if (!utils.isobject(to[nextkey]) && utils.isobject(nextsource[nextkey])) {
to[nextkey] = {};
utils.extend(to[nextkey], nextsource[nextkey]);
} else {
to[nextkey] = nextsource[nextkey];
}
}
}
}
}
return to;
},
};
var d;
if (typeof document === 'undefined') {
d = {
addeventlistener: function addeventlistener() {},
removeeventlistener: function removeeventlistener() {},
activeelement: {
blur: function blur() {},
nodename: '',
},
queryselector: function queryselector() {
return {};
},
queryselectorall: function queryselectorall() {
return [];
},
createelement: function createelement() {
return {
style: {},
setattribute: function setattribute() {},
getelementsbytagname: function getelementsbytagname() {
return [];
},
};
},
location: { hash: '' },
};
} else {
d = document;
}
var doc = d;
var support = (function support() {
return {
touch: (win.modernizr && win.modernizr.touch === true) || (function checktouch() {
return !!(('ontouchstart' in win) || (win.documenttouch && doc instanceof win.documenttouch));
}()),
transforms3d: (win.modernizr && win.modernizr.csstransforms3d === true) || (function checktransforms3d() {
var div = doc.createelement('div').style;
return ('webkitperspective' in div || 'mozperspective' in div || 'operspective' in div || 'msperspective' in div || 'perspective' in div);
}()),
flexbox: (function checkflexbox() {
var div = doc.createelement('div').style;
var styles = ('alignitems webkitalignitems webkitboxalign msflexalign mozboxalign webkitflexdirection msflexdirection mozboxdirection mozboxorient webkitboxdirection webkitboxorient').split(' ');
for (var i = 0; i < styles.length; i += 1) {
if (styles[i] in div) { return true; }
}
return false;
}()),
observer: (function checkobserver() {
return ('mutationobserver' in win || 'webkitmutationobserver' in win);
}()),
passivelistener: (function checkpassivelistener() {
var supportspassive = false;
try {
var opts = object.defineproperty({}, 'passive', {
get: function get() {
supportspassive = true;
},
});
win.addeventlistener('testpassivelistener', null, opts);
} catch (e) {
// no support
}
return supportspassive;
}()),
gestures: (function checkgestures() {
return 'ongesturestart' in win;
}()),
};
}());
var swiperclass = function swiperclass(params) {
if ( params === void 0 ) params = {};
var self = this;
self.params = params;
// events
self.eventslisteners = {};
if (self.params && self.params.on) {
object.keys(self.params.on).foreach(function (eventname) {
self.on(eventname, self.params.on[eventname]);
});
}
};
var staticaccessors = { components: {} };
swiperclass.prototype.on = function on (events, handler) {
var self = this;
if (typeof handler !== 'function') { return self; }
events.split(' ').foreach(function (event) {
if (!self.eventslisteners[event]) { self.eventslisteners[event] = []; }
self.eventslisteners[event].push(handler);
});
return self;
};
swiperclass.prototype.once = function once (events, handler) {
var self = this;
if (typeof handler !== 'function') { return self; }
function oncehandler() {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
handler.apply(self, args);
self.off(events, oncehandler);
}
return self.on(events, oncehandler);
};
swiperclass.prototype.off = function off (events, handler) {
var self = this;
events.split(' ').foreach(function (event) {
if (typeof handler === 'undefined') {
self.eventslisteners[event] = [];
} else {
self.eventslisteners[event].foreach(function (eventhandler, index) {
if (eventhandler === handler) {
self.eventslisteners[event].splice(index, 1);
}
});
}
});
return self;
};
swiperclass.prototype.emit = function emit () {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
var self = this;
if (!self.eventslisteners) { return self; }
var events;
var data;
var context;
if (typeof args[0] === 'string' || array.isarray(args[0])) {
events = args[0];
data = args.slice(1, args.length);
context = self;
} else {
events = args[0].events;
data = args[0].data;
context = args[0].context || self;
}
var eventsarray = array.isarray(events) ? events : events.split(' ');
eventsarray.foreach(function (event) {
if (self.eventslisteners[event]) {
var handlers = [];
self.eventslisteners[event].foreach(function (eventhandler) {
handlers.push(eventhandler);
});
handlers.foreach(function (eventhandler) {
eventhandler.apply(context, data);
});
}
});
return self;
};
swiperclass.prototype.usemodulesparams = function usemodulesparams (instanceparams) {
var instance = this;
if (!instance.modules) { return; }
object.keys(instance.modules).foreach(function (modulename) {
var module = instance.modules[modulename];
// extend params
if (module.params) {
utils.extend(instanceparams, module.params);
}
});
};
swiperclass.prototype.usemodules = function usemodules (modulesparams) {
if ( modulesparams === void 0 ) modulesparams = {};
var instance = this;
if (!instance.modules) { return; }
object.keys(instance.modules).foreach(function (modulename) {
var module = instance.modules[modulename];
var moduleparams = modulesparams[modulename] || {};
// extend instance methods and props
if (module.instance) {
object.keys(module.instance).foreach(function (modulepropname) {
var moduleprop = module.instance[modulepropname];
if (typeof moduleprop === 'function') {
instance[modulepropname] = moduleprop.bind(instance);
} else {
instance[modulepropname] = moduleprop;
}
});
}
// add event listeners
if (module.on && instance.on) {
object.keys(module.on).foreach(function (moduleeventname) {
instance.on(moduleeventname, module.on[moduleeventname]);
});
}
// module create callback
if (module.create) {
module.create.bind(instance)(moduleparams);
}
});
};
staticaccessors.components.set = function (components) {
var class = this;
if (!class.use) { return; }
class.use(components);
};
swiperclass.installmodule = function installmodule (module) {
var params = [], len = arguments.length - 1;
while ( len-- > 0 ) params[ len ] = arguments[ len + 1 ];
var class = this;
if (!class.prototype.modules) { class.prototype.modules = {}; }
var name = module.name || (((object.keys(class.prototype.modules).length) + "_" + (utils.now())));
class.prototype.modules[name] = module;
// prototype
if (module.proto) {
object.keys(module.proto).foreach(function (key) {
class.prototype[key] = module.proto[key];
});
}
// class
if (module.static) {
object.keys(module.static).foreach(function (key) {
class[key] = module.static[key];
});
}
// callback
if (module.install) {
module.install.apply(class, params);
}
return class;
};
swiperclass.use = function use (module) {
var params = [], len = arguments.length - 1;
while ( len-- > 0 ) params[ len ] = arguments[ len + 1 ];
var class = this;
if (array.isarray(module)) {
module.foreach(function (m) { return class.installmodule(m); });
return class;
}
return class.installmodule.apply(class, [ module ].concat( params ));
};
object.defineproperties( swiperclass, staticaccessors );
var updatesize = function () {
var swiper = this;
var width;
var height;
var $el = swiper.$el;
if (typeof swiper.params.width !== 'undefined') {
width = swiper.params.width;
} else {
width = $el[0].clientwidth;
}
if (typeof swiper.params.height !== 'undefined') {
height = swiper.params.height;
} else {
height = $el[0].clientheight;
}
if ((width === 0 && swiper.ishorizontal()) || (height === 0 && swiper.isvertical())) {
return;
}
// subtract paddings
width = width - parseint($el.css('padding-left'), 10) - parseint($el.css('padding-right'), 10);
height = height - parseint($el.css('padding-top'), 10) - parseint($el.css('padding-bottom'), 10);
utils.extend(swiper, {
width: width,
height: height,
size: swiper.ishorizontal() ? width : height,
});
};
var updateslides = function () {
var swiper = this;
var params = swiper.params;
var $wrapperel = swiper.$wrapperel;
var swipersize = swiper.size;
var rtl = swiper.rtl;
var wrongrtl = swiper.wrongrtl;
var slides = $wrapperel.children(("." + (swiper.params.slideclass)));
var isvirtual = swiper.virtual && params.virtual.enabled;
var slideslength = isvirtual ? swiper.virtual.slides.length : slides.length;
var snapgrid = [];
var slidesgrid = [];
var slidessizesgrid = [];
var offsetbefore = params.slidesoffsetbefore;
if (typeof offsetbefore === 'function') {
offsetbefore = params.slidesoffsetbefore.call(swiper);
}
var offsetafter = params.slidesoffsetafter;
if (typeof offsetafter === 'function') {
offsetafter = params.slidesoffsetafter.call(swiper);
}
var previousslideslength = slideslength;
var previoussnapgridlength = swiper.snapgrid.length;
var previousslidesgridlength = swiper.snapgrid.length;
var spacebetween = params.spacebetween;
var slideposition = -offsetbefore;
var prevslidesize = 0;
var index = 0;
if (typeof swipersize === 'undefined') {
return;
}
if (typeof spacebetween === 'string' && spacebetween.indexof('%') >= 0) {
spacebetween = (parsefloat(spacebetween.replace('%', '')) / 100) * swipersize;
}
swiper.virtualsize = -spacebetween;
// reset margins
if (rtl) { slides.css({ marginleft: '', margintop: '' }); }
else { slides.css({ marginright: '', marginbottom: '' }); }
var slidesnumbereventorows;
if (params.slidespercolumn > 1) {
if (math.floor(slideslength / params.slidespercolumn) === slideslength / swiper.params.slidespercolumn) {
slidesnumbereventorows = slideslength;
} else {
slidesnumbereventorows = math.ceil(slideslength / params.slidespercolumn) * params.slidespercolumn;
}
if (params.slidesperview !== 'auto' && params.slidespercolumnfill === 'row') {
slidesnumbereventorows = math.max(slidesnumbereventorows, params.slidesperview * params.slidespercolumn);
}
}
// calc slides
var slidesize;
var slidespercolumn = params.slidespercolumn;
var slidesperrow = slidesnumbereventorows / slidespercolumn;
var numfullcolumns = slidesperrow - ((params.slidespercolumn * slidesperrow) - slideslength);
for (var i = 0; i < slideslength; i += 1) {
slidesize = 0;
var slide = slides.eq(i);
if (params.slidespercolumn > 1) {
// set slides order
var newslideorderindex = (void 0);
var column = (void 0);
var row = (void 0);
if (params.slidespercolumnfill === 'column') {
column = math.floor(i / slidespercolumn);
row = i - (column * slidespercolumn);
if (column > numfullcolumns || (column === numfullcolumns && row === slidespercolumn - 1)) {
row += 1;
if (row >= slidespercolumn) {
row = 0;
column += 1;
}
}
newslideorderindex = column + ((row * slidesnumbereventorows) / slidespercolumn);
slide
.css({
'-webkit-box-ordinal-group': newslideorderindex,
'-moz-box-ordinal-group': newslideorderindex,
'-ms-flex-order': newslideorderindex,
'-webkit-order': newslideorderindex,
order: newslideorderindex,
});
} else {
row = math.floor(i / slidesperrow);
column = i - (row * slidesperrow);
}
slide
.css(
("margin-" + (swiper.ishorizontal() ? 'top' : 'left')),
(row !== 0 && params.spacebetween) && (((params.spacebetween) + "px"))
)
.attr('data-swiper-column', column)
.attr('data-swiper-row', row);
}
if (slide.css('display') === 'none') { continue; } // eslint-disable-line
if (params.slidesperview === 'auto') {
slidesize = swiper.ishorizontal() ? slide.outerwidth(true) : slide.outerheight(true);
if (params.roundlengths) { slidesize = math.floor(slidesize); }
} else {
slidesize = (swipersize - ((params.slidesperview - 1) * spacebetween)) / params.slidesperview;
if (params.roundlengths) { slidesize = math.floor(slidesize); }
if (slides[i]) {
if (swiper.ishorizontal()) {
slides[i].style.width = slidesize + "px";
} else {
slides[i].style.height = slidesize + "px";
}
}
}
if (slides[i]) {
slides[i].swiperslidesize = slidesize;
}
slidessizesgrid.push(slidesize);
if (params.centeredslides) {
slideposition = slideposition + (slidesize / 2) + (prevslidesize / 2) + spacebetween;
if (prevslidesize === 0 && i !== 0) { slideposition = slideposition - (swipersize / 2) - spacebetween; }
if (i === 0) { slideposition = slideposition - (swipersize / 2) - spacebetween; }
if (math.abs(slideposition) < 1 / 1000) { slideposition = 0; }
if ((index) % params.slidespergroup === 0) { snapgrid.push(slideposition); }
slidesgrid.push(slideposition);
} else {
if ((index) % params.slidespergroup === 0) { snapgrid.push(slideposition); }
slidesgrid.push(slideposition);
slideposition = slideposition + slidesize + spacebetween;
}
swiper.virtualsize += slidesize + spacebetween;
prevslidesize = slidesize;
index += 1;
}
swiper.virtualsize = math.max(swiper.virtualsize, swipersize) + offsetafter;
var newslidesgrid;
if (
rtl && wrongrtl && (params.effect === 'slide' || params.effect === 'coverflow')) {
$wrapperel.css({ width: ((swiper.virtualsize + params.spacebetween) + "px") });
}
if (!support.flexbox || params.setwrappersize) {
if (swiper.ishorizontal()) { $wrapperel.css({ width: ((swiper.virtualsize + params.spacebetween) + "px") }); }
else { $wrapperel.css({ height: ((swiper.virtualsize + params.spacebetween) + "px") }); }
}
if (params.slidespercolumn > 1) {
swiper.virtualsize = (slidesize + params.spacebetween) * slidesnumbereventorows;
swiper.virtualsize = math.ceil(swiper.virtualsize / params.slidespercolumn) - params.spacebetween;
if (swiper.ishorizontal()) { $wrapperel.css({ width: ((swiper.virtualsize + params.spacebetween) + "px") }); }
else { $wrapperel.css({ height: ((swiper.virtualsize + params.spacebetween) + "px") }); }
if (params.centeredslides) {
newslidesgrid = [];
for (var i$1 = 0; i$1 < snapgrid.length; i$1 += 1) {
if (snapgrid[i$1] < swiper.virtualsize + snapgrid[0]) { newslidesgrid.push(snapgrid[i$1]); }
}
snapgrid = newslidesgrid;
}
}
// remove last grid elements depending on width
if (!params.centeredslides) {
newslidesgrid = [];
for (var i$2 = 0; i$2 < snapgrid.length; i$2 += 1) {
if (snapgrid[i$2] <= swiper.virtualsize - swipersize) {
newslidesgrid.push(snapgrid[i$2]);
}
}
snapgrid = newslidesgrid;
if (math.floor(swiper.virtualsize - swipersize) - math.floor(snapgrid[snapgrid.length - 1]) > 1) {
snapgrid.push(swiper.virtualsize - swipersize);
}
}
if (snapgrid.length === 0) { snapgrid = [0]; }
if (params.spacebetween !== 0) {
if (swiper.ishorizontal()) {
if (rtl) { slides.css({ marginleft: (spacebetween + "px") }); }
else { slides.css({ marginright: (spacebetween + "px") }); }
} else { slides.css({ marginbottom: (spacebetween + "px") }); }
}
utils.extend(swiper, {
slides: slides,
snapgrid: snapgrid,
slidesgrid: slidesgrid,
slidessizesgrid: slidessizesgrid,
});
if (slideslength !== previousslideslength) {
swiper.emit('slideslengthchange');
}
if (snapgrid.length !== previoussnapgridlength) {
swiper.emit('snapgridlengthchange');
}
if (slidesgrid.length !== previousslidesgridlength) {
swiper.emit('slidesgridlengthchange');
}
if (params.watchslidesprogress || params.watchslidesvisibility) {
swiper.updateslidesoffset();
}
};
var updateautoheight = function () {
var swiper = this;
var activeslides = [];
var newheight = 0;
var i;
// find slides currently in view
if (swiper.params.slidesperview !== 'auto' && swiper.params.slidesperview > 1) {
for (i = 0; i < math.ceil(swiper.params.slidesperview); i += 1) {
var index = swiper.activeindex + i;
if (index > swiper.slides.length) { break; }
activeslides.push(swiper.slides.eq(index)[0]);
}
} else {
activeslides.push(swiper.slides.eq(swiper.activeindex)[0]);
}
// find new height from highest slide in view
for (i = 0; i < activeslides.length; i += 1) {
if (typeof activeslides[i] !== 'undefined') {
var height = activeslides[i].offsetheight;
newheight = height > newheight ? height : newheight;
}
}
// update height
if (newheight) { swiper.$wrapperel.css('height', (newheight + "px")); }
};
var updateslidesoffset = function () {
var swiper = this;
var slides = swiper.slides;
for (var i = 0; i < slides.length; i += 1) {
slides[i].swiperslideoffset = swiper.ishorizontal() ? slides[i].offsetleft : slides[i].offsettop;
}
};
var updateslidesprogress = function (translate) {
if ( translate === void 0 ) translate = this.translate || 0;
var swiper = this;
var params = swiper.params;
var slides = swiper.slides;
var rtl = swiper.rtl;
if (slides.length === 0) { return; }
if (typeof slides[0].swiperslideoffset === 'undefined') { swiper.updateslidesoffset(); }
var offsetcenter = -translate;
if (rtl) { offsetcenter = translate; }
// visible slides
slides.removeclass(params.slidevisibleclass);
for (var i = 0; i < slides.length; i += 1) {
var slide = slides[i];
var slideprogress =
(
(offsetcenter + (params.centeredslides ? swiper.mintranslate() : 0)) - slide.swiperslideoffset
) / (slide.swiperslidesize + params.spacebetween);
if (params.watchslidesvisibility) {
var slidebefore = -(offsetcenter - slide.swiperslideoffset);
var slideafter = slidebefore + swiper.slidessizesgrid[i];
var isvisible =
(slidebefore >= 0 && slidebefore < swiper.size) ||
(slideafter > 0 && slideafter <= swiper.size) ||
(slidebefore <= 0 && slideafter >= swiper.size);
if (isvisible) {
slides.eq(i).addclass(params.slidevisibleclass);
}
}
slide.progress = rtl ? -slideprogress : slideprogress;
}
};
var updateprogress = function (translate) {
if ( translate === void 0 ) translate = this.translate || 0;
var swiper = this;
var params = swiper.params;
var translatesdiff = swiper.maxtranslate() - swiper.mintranslate();
var progress = swiper.progress;
var isbeginning = swiper.isbeginning;
var isend = swiper.isend;
var wasbeginning = isbeginning;
var wasend = isend;
if (translatesdiff === 0) {
progress = 0;
isbeginning = true;
isend = true;
} else {
progress = (translate - swiper.mintranslate()) / (translatesdiff);
isbeginning = progress <= 0;
isend = progress >= 1;
}
utils.extend(swiper, {
progress: progress,
isbeginning: isbeginning,
isend: isend,
});
if (params.watchslidesprogress || params.watchslidesvisibility) { swiper.updateslidesprogress(translate); }
if (isbeginning && !wasbeginning) {
swiper.emit('reachbeginning toedge');
}
if (isend && !wasend) {
swiper.emit('reachend toedge');
}
if ((wasbeginning && !isbeginning) || (wasend && !isend)) {
swiper.emit('fromedge');
}
swiper.emit('progress', progress);
};
var updateslidesclasses = function () {
var swiper = this;
var slides = swiper.slides;
var params = swiper.params;
var $wrapperel = swiper.$wrapperel;
var activeindex = swiper.activeindex;
var realindex = swiper.realindex;
var isvirtual = swiper.virtual && params.virtual.enabled;
slides.removeclass(((params.slideactiveclass) + " " + (params.slidenextclass) + " " + (params.slideprevclass) + " " + (params.slideduplicateactiveclass) + " " + (params.slideduplicatenextclass) + " " + (params.slideduplicateprevclass)));
var activeslide;
if (isvirtual) {
activeslide = swiper.$wrapperel.find(("." + (params.slideclass) + "[data-swiper-slide-index=\"" + activeindex + "\"]"));
} else {
activeslide = slides.eq(activeindex);
}
// active classes
activeslide.addclass(params.slideactiveclass);
if (params.loop) {
// duplicate to all looped slides
if (activeslide.hasclass(params.slideduplicateclass)) {
$wrapperel
.children(("." + (params.slideclass) + ":not(." + (params.slideduplicateclass) + ")[data-swiper-slide-index=\"" + realindex + "\"]"))
.addclass(params.slideduplicateactiveclass);
} else {
$wrapperel
.children(("." + (params.slideclass) + "." + (params.slideduplicateclass) + "[data-swiper-slide-index=\"" + realindex + "\"]"))
.addclass(params.slideduplicateactiveclass);
}
}
// next slide
var nextslide = activeslide.nextall(("." + (params.slideclass))).eq(0).addclass(params.slidenextclass);
if (params.loop && nextslide.length === 0) {
nextslide = slides.eq(0);
nextslide.addclass(params.slidenextclass);
}
// prev slide
var prevslide = activeslide.prevall(("." + (params.slideclass))).eq(0).addclass(params.slideprevclass);
if (params.loop && prevslide.length === 0) {
prevslide = slides.eq(-1);
prevslide.addclass(params.slideprevclass);
}
if (params.loop) {
// duplicate to all looped slides
if (nextslide.hasclass(params.slideduplicateclass)) {
$wrapperel
.children(("." + (params.slideclass) + ":not(." + (params.slideduplicateclass) + ")[data-swiper-slide-index=\"" + (nextslide.attr('data-swiper-slide-index')) + "\"]"))
.addclass(params.slideduplicatenextclass);
} else {
$wrapperel
.children(("." + (params.slideclass) + "." + (params.slideduplicateclass) + "[data-swiper-slide-index=\"" + (nextslide.attr('data-swiper-slide-index')) + "\"]"))
.addclass(params.slideduplicatenextclass);
}
if (prevslide.hasclass(params.slideduplicateclass)) {
$wrapperel
.children(("." + (params.slideclass) + ":not(." + (params.slideduplicateclass) + ")[data-swiper-slide-index=\"" + (prevslide.attr('data-swiper-slide-index')) + "\"]"))
.addclass(params.slideduplicateprevclass);
} else {
$wrapperel
.children(("." + (params.slideclass) + "." + (params.slideduplicateclass) + "[data-swiper-slide-index=\"" + (prevslide.attr('data-swiper-slide-index')) + "\"]"))
.addclass(params.slideduplicateprevclass);
}
}
};
var updateactiveindex = function (newactiveindex) {
var swiper = this;
var translate = swiper.rtl ? swiper.translate : -swiper.translate;
var slidesgrid = swiper.slidesgrid;
var snapgrid = swiper.snapgrid;
var params = swiper.params;
var previousindex = swiper.activeindex;
var previousrealindex = swiper.realindex;
var previoussnapindex = swiper.snapindex;
var activeindex = newactiveindex;
var snapindex;
if (typeof activeindex === 'undefined') {
for (var i = 0; i < slidesgrid.length; i += 1) {
if (typeof slidesgrid[i + 1] !== 'undefined') {
if (translate >= slidesgrid[i] && translate < slidesgrid[i + 1] - ((slidesgrid[i + 1] - slidesgrid[i]) / 2)) {
activeindex = i;
} else if (translate >= slidesgrid[i] && translate < slidesgrid[i + 1]) {
activeindex = i + 1;
}
} else if (translate >= slidesgrid[i]) {
activeindex = i;
}
}
// normalize slideindex
if (params.normalizeslideindex) {
if (activeindex < 0 || typeof activeindex === 'undefined') { activeindex = 0; }
}
}
if (snapgrid.indexof(translate) >= 0) {
snapindex = snapgrid.indexof(translate);
} else {
snapindex = math.floor(activeindex / params.slidespergroup);
}
if (snapindex >= snapgrid.length) { snapindex = snapgrid.length - 1; }
if (activeindex === previousindex) {
if (snapindex !== previoussnapindex) {
swiper.snapindex = snapindex;
swiper.emit('snapindexchange');
}
return;
}
// get real index
var realindex = parseint(swiper.slides.eq(activeindex).attr('data-swiper-slide-index') || activeindex, 10);
utils.extend(swiper, {
snapindex: snapindex,
realindex: realindex,
previousindex: previousindex,
activeindex: activeindex,
});
swiper.emit('activeindexchange');
swiper.emit('snapindexchange');
if (previousrealindex !== realindex) {
swiper.emit('realindexchange');
}
swiper.emit('slidechange');
};
var updateclickedslide = function (e) {
var swiper = this;
var params = swiper.params;
var slide = $$1(e.target).closest(("." + (params.slideclass)))[0];
var slidefound = false;
if (slide) {
for (var i = 0; i < swiper.slides.length; i += 1) {
if (swiper.slides[i] === slide) { slidefound = true; }
}
}
if (slide && slidefound) {
swiper.clickedslide = slide;
if (swiper.virtual && swiper.params.virtual.enabled) {
swiper.clickedindex = parseint($$1(slide).attr('data-swiper-slide-index'), 10);
} else {
swiper.clickedindex = $$1(slide).index();
}
} else {
swiper.clickedslide = undefined;
swiper.clickedindex = undefined;
return;
}
if (params.slidetoclickedslide && swiper.clickedindex !== undefined && swiper.clickedindex !== swiper.activeindex) {
swiper.slidetoclickedslide();
}
};
var update = {
updatesize: updatesize,
updateslides: updateslides,
updateautoheight: updateautoheight,
updateslidesoffset: updateslidesoffset,
updateslidesprogress: updateslidesprogress,
updateprogress: updateprogress,
updateslidesclasses: updateslidesclasses,
updateactiveindex: updateactiveindex,
updateclickedslide: updateclickedslide,
};
var gettranslate = function (axis) {
if ( axis === void 0 ) axis = this.ishorizontal() ? 'x' : 'y';
var swiper = this;
var params = swiper.params;
var rtl = swiper.rtl;
var translate = swiper.translate;
var $wrapperel = swiper.$wrapperel;
if (params.virtualtranslate) {
return rtl ? -translate : translate;
}
var currenttranslate = utils.gettranslate($wrapperel[0], axis);
if (rtl) { currenttranslate = -currenttranslate; }
return currenttranslate || 0;
};
var settranslate = function (translate, bycontroller) {
var swiper = this;
var rtl = swiper.rtl;
var params = swiper.params;
var $wrapperel = swiper.$wrapperel;
var progress = swiper.progress;
var x = 0;
var y = 0;
var z = 0;
if (swiper.ishorizontal()) {
x = rtl ? -translate : translate;
} else {
y = translate;
}
if (params.roundlengths) {
x = math.floor(x);
y = math.floor(y);
}
if (!params.virtualtranslate) {
if (support.transforms3d) { $wrapperel.transform(("translate3d(" + x + "px, " + y + "px, " + z + "px)")); }
else { $wrapperel.transform(("translate(" + x + "px, " + y + "px)")); }
}
swiper.translate = swiper.ishorizontal() ? x : y;
// check if we need to update progress
var newprogress;
var translatesdiff = swiper.maxtranslate() - swiper.mintranslate();
if (translatesdiff === 0) {
newprogress = 0;
} else {
newprogress = (translate - swiper.mintranslate()) / (translatesdiff);
}
if (newprogress !== progress) {
swiper.updateprogress(translate);
}
swiper.emit('settranslate', swiper.translate, bycontroller);
};
var mintranslate = function () {
return (-this.snapgrid[0]);
};
var maxtranslate = function () {
return (-this.snapgrid[this.snapgrid.length - 1]);
};
var translate = {
gettranslate: gettranslate,
settranslate: settranslate,
mintranslate: mintranslate,
maxtranslate: maxtranslate,
};
var settransition = function (duration, bycontroller) {
var swiper = this;
swiper.$wrapperel.transition(duration);
swiper.emit('settransition', duration, bycontroller);
};
var transitionstart = function (runcallbacks) {
if ( runcallbacks === void 0 ) runcallbacks = true;
var swiper = this;
var activeindex = swiper.activeindex;
var params = swiper.params;
var previousindex = swiper.previousindex;
if (params.autoheight) {
swiper.updateautoheight();
}
swiper.emit('transitionstart');
if (!runcallbacks) { return; }
if (activeindex !== previousindex) {
swiper.emit('slidechangetransitionstart');
if (activeindex > previousindex) {
swiper.emit('slidenexttransitionstart');
} else {
swiper.emit('slideprevtransitionstart');
}
}
};
var transitionend$1 = function (runcallbacks) {
if ( runcallbacks === void 0 ) runcallbacks = true;
var swiper = this;
var activeindex = swiper.activeindex;
var previousindex = swiper.previousindex;
swiper.animating = false;
swiper.settransition(0);
swiper.emit('transitionend');
if (runcallbacks) {
if (activeindex !== previousindex) {
swiper.emit('slidechangetransitionend');
if (activeindex > previousindex) {
swiper.emit('slidenexttransitionend');
} else {
swiper.emit('slideprevtransitionend');
}
}
}
};
var transition$1 = {
settransition: settransition,
transitionstart: transitionstart,
transitionend: transitionend$1,
};
var browser = (function browser() {
function isie9() {
// create temporary div
var div = doc.createelement('div');
// add content to tmp div which is wrapped into the ie html conditional statement
div.innerhtml = '';
// return true / false value based on what will browser render
return div.getelementsbytagname('i').length === 1;
}
function issafari() {
var ua = win.navigator.useragent.tolowercase();
return (ua.indexof('safari') >= 0 && ua.indexof('chrome') < 0 && ua.indexof('android') < 0);
}
return {
issafari: issafari(),
isuiwebview: /(iphone|ipod|ipad).*applewebkit(?!.*safari)/i.test(win.navigator.useragent),
ie: win.navigator.pointerenabled || win.navigator.mspointerenabled,
ietouch: (win.navigator.mspointerenabled && win.navigator.msmaxtouchpoints > 1) ||
(win.navigator.pointerenabled && win.navigator.maxtouchpoints > 1),
lteie9: isie9(),
};
}());
var slideto = function (index, speed, runcallbacks, internal) {
if ( index === void 0 ) index = 0;
if ( speed === void 0 ) speed = this.params.speed;
if ( runcallbacks === void 0 ) runcallbacks = true;
var swiper = this;
var slideindex = index;
if (slideindex < 0) { slideindex = 0; }
var params = swiper.params;
var snapgrid = swiper.snapgrid;
var slidesgrid = swiper.slidesgrid;
var previousindex = swiper.previousindex;
var activeindex = swiper.activeindex;
var rtl = swiper.rtl;
var $wrapperel = swiper.$wrapperel;
var snapindex = math.floor(slideindex / params.slidespergroup);
if (snapindex >= snapgrid.length) { snapindex = snapgrid.length - 1; }
if ((activeindex || params.initialslide || 0) === (previousindex || 0) && runcallbacks) {
swiper.emit('beforeslidechangestart');
}
var translate = -snapgrid[snapindex];
// update progress
swiper.updateprogress(translate);
// normalize slideindex
if (params.normalizeslideindex) {
for (var i = 0; i < slidesgrid.length; i += 1) {
if (-math.floor(translate * 100) >= math.floor(slidesgrid[i] * 100)) {
slideindex = i;
}
}
}
// directions locks
if (!swiper.allowslidenext && translate < swiper.translate && translate < swiper.mintranslate()) {
return false;
}
if (!swiper.allowslideprev && translate > swiper.translate && translate > swiper.maxtranslate()) {
if ((activeindex || 0) !== slideindex) { return false; }
}
// update index
if ((rtl && -translate === swiper.translate) || (!rtl && translate === swiper.translate)) {
swiper.updateactiveindex(slideindex);
// update height
if (params.autoheight) {
swiper.updateautoheight();
}
swiper.updateslidesclasses();
if (params.effect !== 'slide') {
swiper.settranslate(translate);
}
return false;
}
if (speed === 0 || browser.lteie9) {
swiper.settransition(0);
swiper.settranslate(translate);
swiper.updateactiveindex(slideindex);
swiper.updateslidesclasses();
swiper.emit('beforetransitionstart', speed, internal);
swiper.transitionstart(runcallbacks);
swiper.transitionend(runcallbacks);
} else {
swiper.settransition(speed);
swiper.settranslate(translate);
swiper.updateactiveindex(slideindex);
swiper.updateslidesclasses();
swiper.emit('beforetransitionstart', speed, internal);
swiper.transitionstart(runcallbacks);
if (!swiper.animating) {
swiper.animating = true;
$wrapperel.transitionend(function () {
if (!swiper || swiper.destroyed) { return; }
swiper.transitionend(runcallbacks);
});
}
}
return true;
};
/* eslint no-unused-vars: "off" */
var slidenext = function (speed, runcallbacks, internal) {
if ( speed === void 0 ) speed = this.params.speed;
if ( runcallbacks === void 0 ) runcallbacks = true;
var swiper = this;
var params = swiper.params;
var animating = swiper.animating;
if (params.loop) {
if (animating) { return false; }
swiper.loopfix();
// eslint-disable-next-line
swiper._clientleft = swiper.$wrapperel[0].clientleft;
return swiper.slideto(swiper.activeindex + params.slidespergroup, speed, runcallbacks, internal);
}
return swiper.slideto(swiper.activeindex + params.slidespergroup, speed, runcallbacks, internal);
};
/* eslint no-unused-vars: "off" */
var slideprev = function (speed, runcallbacks, internal) {
if ( speed === void 0 ) speed = this.params.speed;
if ( runcallbacks === void 0 ) runcallbacks = true;
var swiper = this;
var params = swiper.params;
var animating = swiper.animating;
if (params.loop) {
if (animating) { return false; }
swiper.loopfix();
// eslint-disable-next-line
swiper._clientleft = swiper.$wrapperel[0].clientleft;
return swiper.slideto(swiper.activeindex - 1, speed, runcallbacks, internal);
}
return swiper.slideto(swiper.activeindex - 1, speed, runcallbacks, internal);
};
/* eslint no-unused-vars: "off" */
var slidereset = function (speed, runcallbacks, internal) {
if ( speed === void 0 ) speed = this.params.speed;
if ( runcallbacks === void 0 ) runcallbacks = true;
var swiper = this;
return swiper.slideto(swiper.activeindex, speed, runcallbacks, internal);
};
var slidetoclickedslide = function () {
var swiper = this;
var params = swiper.params;
var $wrapperel = swiper.$wrapperel;
var slidesperview = params.slidesperview === 'auto' ? swiper.slidesperviewdynamic() : params.slidesperview;
var slidetoindex = swiper.clickedindex;
var realindex;
if (params.loop) {
if (swiper.animating) { return; }
realindex = parseint($$1(swiper.clickedslide).attr('data-swiper-slide-index'), 10);
if (params.centeredslides) {
if (
(slidetoindex < swiper.loopedslides - (slidesperview / 2)) ||
(slidetoindex > (swiper.slides.length - swiper.loopedslides) + (slidesperview / 2))
) {
swiper.loopfix();
slidetoindex = $wrapperel
.children(("." + (params.slideclass) + "[data-swiper-slide-index=\"" + realindex + "\"]:not(." + (params.slideduplicateclass) + ")"))
.eq(0)
.index();
utils.nexttick(function () {
swiper.slideto(slidetoindex);
});
} else {
swiper.slideto(slidetoindex);
}
} else if (slidetoindex > swiper.slides.length - slidesperview) {
swiper.loopfix();
slidetoindex = $wrapperel
.children(("." + (params.slideclass) + "[data-swiper-slide-index=\"" + realindex + "\"]:not(." + (params.slideduplicateclass) + ")"))
.eq(0)
.index();
utils.nexttick(function () {
swiper.slideto(slidetoindex);
});
} else {
swiper.slideto(slidetoindex);
}
} else {
swiper.slideto(slidetoindex);
}
};
var slide = {
slideto: slideto,
slidenext: slidenext,
slideprev: slideprev,
slidereset: slidereset,
slidetoclickedslide: slidetoclickedslide,
};
var loopcreate = function () {
var swiper = this;
var params = swiper.params;
var $wrapperel = swiper.$wrapperel;
// remove duplicated slides
$wrapperel.children(("." + (params.slideclass) + "." + (params.slideduplicateclass))).remove();
var slides = $wrapperel.children(("." + (params.slideclass)));
if (params.loopfillgroupwithblank) {
var blankslidesnum = params.slidespergroup - (slides.length % params.slidespergroup);
if (blankslidesnum !== params.slidespergroup) {
for (var i = 0; i < blankslidesnum; i += 1) {
var blanknode = $$1(doc.createelement('div')).addclass(((params.slideclass) + " " + (params.slideblankclass)));
$wrapperel.append(blanknode);
}
slides = $wrapperel.children(("." + (params.slideclass)));
}
}
if (params.slidesperview === 'auto' && !params.loopedslides) { params.loopedslides = slides.length; }
swiper.loopedslides = parseint(params.loopedslides || params.slidesperview, 10);
swiper.loopedslides += params.loopadditionalslides;
if (swiper.loopedslides > slides.length) {
swiper.loopedslides = slides.length;
}
var prependslides = [];
var appendslides = [];
slides.each(function (index, el) {
var slide = $$1(el);
if (index < swiper.loopedslides) { appendslides.push(el); }
if (index < slides.length && index >= slides.length - swiper.loopedslides) { prependslides.push(el); }
slide.attr('data-swiper-slide-index', index);
});
for (var i$1 = 0; i$1 < appendslides.length; i$1 += 1) {
$wrapperel.append($$1(appendslides[i$1].clonenode(true)).addclass(params.slideduplicateclass));
}
for (var i$2 = prependslides.length - 1; i$2 >= 0; i$2 -= 1) {
$wrapperel.prepend($$1(prependslides[i$2].clonenode(true)).addclass(params.slideduplicateclass));
}
};
var loopfix = function () {
var swiper = this;
var params = swiper.params;
var activeindex = swiper.activeindex;
var slides = swiper.slides;
var loopedslides = swiper.loopedslides;
var allowslideprev = swiper.allowslideprev;
var allowslidenext = swiper.allowslidenext;
var newindex;
swiper.allowslideprev = true;
swiper.allowslidenext = true;
// fix for negative oversliding
if (activeindex < loopedslides) {
newindex = (slides.length - (loopedslides * 3)) + activeindex;
newindex += loopedslides;
swiper.slideto(newindex, 0, false, true);
} else if ((params.slidesperview === 'auto' && activeindex >= loopedslides * 2) || (activeindex > slides.length - (params.slidesperview * 2))) {
// fix for positive oversliding
newindex = -slides.length + activeindex + loopedslides;
newindex += loopedslides;
swiper.slideto(newindex, 0, false, true);
}
swiper.allowslideprev = allowslideprev;
swiper.allowslidenext = allowslidenext;
};
var loopdestroy = function () {
var swiper = this;
var $wrapperel = swiper.$wrapperel;
var params = swiper.params;
var slides = swiper.slides;
$wrapperel.children(("." + (params.slideclass) + "." + (params.slideduplicateclass))).remove();
slides.removeattr('data-swiper-slide-index');
};
var loop = {
loopcreate: loopcreate,
loopfix: loopfix,
loopdestroy: loopdestroy,
};
var setgrabcursor = function (moving) {
var swiper = this;
if (support.touch || !swiper.params.simulatetouch) { return; }
var el = swiper.el;
el.style.cursor = 'move';
el.style.cursor = moving ? '-webkit-grabbing' : '-webkit-grab';
el.style.cursor = moving ? '-moz-grabbin' : '-moz-grab';
el.style.cursor = moving ? 'grabbing' : 'grab';
};
var unsetgrabcursor = function () {
var swiper = this;
if (support.touch) { return; }
swiper.el.style.cursor = '';
};
var grabcursor = {
setgrabcursor: setgrabcursor,
unsetgrabcursor: unsetgrabcursor,
};
var appendslide = function (slides) {
var swiper = this;
var $wrapperel = swiper.$wrapperel;
var params = swiper.params;
if (params.loop) {
swiper.loopdestroy();
}
if (typeof slides === 'object' && 'length' in slides) {
for (var i = 0; i < slides.length; i += 1) {
if (slides[i]) { $wrapperel.append(slides[i]); }
}
} else {
$wrapperel.append(slides);
}
if (params.loop) {
swiper.loopcreate();
}
if (!(params.observer && support.observer)) {
swiper.update();
}
};
var prependslide = function (slides) {
var swiper = this;
var params = swiper.params;
var $wrapperel = swiper.$wrapperel;
var activeindex = swiper.activeindex;
if (params.loop) {
swiper.loopdestroy();
}
var newactiveindex = activeindex + 1;
if (typeof slides === 'object' && 'length' in slides) {
for (var i = 0; i < slides.length; i += 1) {
if (slides[i]) { $wrapperel.prepend(slides[i]); }
}
newactiveindex = activeindex + slides.length;
} else {
$wrapperel.prepend(slides);
}
if (params.loop) {
swiper.loopcreate();
}
if (!(params.observer && support.observer)) {
swiper.update();
}
swiper.slideto(newactiveindex, 0, false);
};
var removeslide = function (slidesindexes) {
var swiper = this;
var params = swiper.params;
var $wrapperel = swiper.$wrapperel;
var activeindex = swiper.activeindex;
if (params.loop) {
swiper.loopdestroy();
swiper.slides = $wrapperel.children(("." + (params.slideclass)));
}
var newactiveindex = activeindex;
var indextoremove;
if (typeof slidesindexes === 'object' && 'length' in slidesindexes) {
for (var i = 0; i < slidesindexes.length; i += 1) {
indextoremove = slidesindexes[i];
if (swiper.slides[indextoremove]) { swiper.slides.eq(indextoremove).remove(); }
if (indextoremove < newactiveindex) { newactiveindex -= 1; }
}
newactiveindex = math.max(newactiveindex, 0);
} else {
indextoremove = slidesindexes;
if (swiper.slides[indextoremove]) { swiper.slides.eq(indextoremove).remove(); }
if (indextoremove < newactiveindex) { newactiveindex -= 1; }
newactiveindex = math.max(newactiveindex, 0);
}
if (params.loop) {
swiper.loopcreate();
}
if (!(params.observer && support.observer)) {
swiper.update();
}
if (params.loop) {
swiper.slideto(newactiveindex + swiper.loopedslides, 0, false);
} else {
swiper.slideto(newactiveindex, 0, false);
}
};
var removeallslides = function () {
var swiper = this;
var slidesindexes = [];
for (var i = 0; i < swiper.slides.length; i += 1) {
slidesindexes.push(i);
}
swiper.removeslide(slidesindexes);
};
var manipulation = {
appendslide: appendslide,
prependslide: prependslide,
removeslide: removeslide,
removeallslides: removeallslides,
};
var device = (function device() {
var ua = win.navigator.useragent;
var device = {
ios: false,
android: false,
androidchrome: false,
desktop: false,
windows: false,
iphone: false,
ipod: false,
ipad: false,
cordova: win.cordova || win.phonegap,
phonegap: win.cordova || win.phonegap,
};
var windows = ua.match(/(windows phone);?[\s\/]+([\d.]+)?/); // eslint-disable-line
var android = ua.match(/(android);?[\s\/]+([\d.]+)?/); // eslint-disable-line
var ipad = ua.match(/(ipad).*os\s([\d_]+)/);
var ipod = ua.match(/(ipod)(.*os\s([\d_]+))?/);
var iphone = !ipad && ua.match(/(iphone\sos|ios)\s([\d_]+)/);
// windows
if (windows) {
device.os = 'windows';
device.osversion = windows[2];
device.windows = true;
}
// android
if (android && !windows) {
device.os = 'android';
device.osversion = android[2];
device.android = true;
device.androidchrome = ua.tolowercase().indexof('chrome') >= 0;
}
if (ipad || iphone || ipod) {
device.os = 'ios';
device.ios = true;
}
// ios
if (iphone && !ipod) {
device.osversion = iphone[2].replace(/_/g, '.');
device.iphone = true;
}
if (ipad) {
device.osversion = ipad[2].replace(/_/g, '.');
device.ipad = true;
}
if (ipod) {
device.osversion = ipod[3] ? ipod[3].replace(/_/g, '.') : null;
device.iphone = true;
}
// ios 8+ changed ua
if (device.ios && device.osversion && ua.indexof('version/') >= 0) {
if (device.osversion.split('.')[0] === '10') {
device.osversion = ua.tolowercase().split('version/')[1].split(' ')[0];
}
}
// desktop
device.desktop = !(device.os || device.android || device.webview);
// webview
device.webview = (iphone || ipad || ipod) && ua.match(/.*applewebkit(?!.*safari)/i);
// minimal ui
if (device.os && device.os === 'ios') {
var osversionarr = device.osversion.split('.');
var metaviewport = doc.queryselector('meta[name="viewport"]');
device.minimalui =
!device.webview &&
(ipod || iphone) &&
(osversionarr[0] * 1 === 7 ? osversionarr[1] * 1 >= 1 : osversionarr[0] * 1 > 7) &&
metaviewport && metaviewport.getattribute('content').indexof('minimal-ui') >= 0;
}
// pixel ratio
device.pixelratio = win.devicepixelratio || 1;
// export object
return device;
}());
var ontouchstart = function (event) {
var swiper = this;
var data = swiper.toucheventsdata;
var params = swiper.params;
var touches = swiper.touches;
var e = event;
if (e.originalevent) { e = e.originalevent; }
data.istouchevent = e.type === 'touchstart';
if (!data.istouchevent && 'which' in e && e.which === 3) { return; }
if (data.istouched && data.ismoved) { return; }
if (params.noswiping && $$1(e.target).closest(("." + (params.noswipingclass)))[0]) {
swiper.allowclick = true;
return;
}
if (params.swipehandler) {
if (!$$1(e).closest(params.swipehandler)[0]) { return; }
}
touches.currentx = e.type === 'touchstart' ? e.targettouches[0].pagex : e.pagex;
touches.currenty = e.type === 'touchstart' ? e.targettouches[0].pagey : e.pagey;
var startx = touches.currentx;
var starty = touches.currenty;
// do not start if ios edge swipe is detected. otherwise ios app (uiwebview) cannot swipe-to-go-back anymore
if (
device.ios &&
!device.cordova &&
params.iosedgeswipedetection &&
(startx <= params.iosedgeswipethreshold) &&
(startx >= window.screen.width - params.iosedgeswipethreshold)
) {
return;
}
utils.extend(data, {
istouched: true,
ismoved: false,
allowtouchcallbacks: true,
isscrolling: undefined,
startmoving: undefined,
});
touches.startx = startx;
touches.starty = starty;
data.touchstarttime = utils.now();
swiper.allowclick = true;
swiper.updatesize();
swiper.swipedirection = undefined;
if (params.threshold > 0) { data.allowthresholdmove = false; }
if (e.type !== 'touchstart') {
var preventdefault = true;
if ($$1(e.target).is(data.formelements)) { preventdefault = false; }
if (doc.activeelement && $$1(doc.activeelement).is(data.formelements)) {
doc.activeelement.blur();
}
if (preventdefault && swiper.allowtouchmove) {
e.preventdefault();
}
}
swiper.emit('touchstart', e);
};
var ontouchmove = function (event) {
var swiper = this;
var data = swiper.toucheventsdata;
var params = swiper.params;
var touches = swiper.touches;
var rtl = swiper.rtl;
var e = event;
if (e.originalevent) { e = e.originalevent; }
if (data.istouchevent && e.type === 'mousemove') { return; }
var pagex = e.type === 'touchmove' ? e.targettouches[0].pagex : e.pagex;
var pagey = e.type === 'touchmove' ? e.targettouches[0].pagey : e.pagey;
if (e.preventedbynestedswiper) {
touches.startx = pagex;
touches.starty = pagey;
return;
}
if (!swiper.allowtouchmove) {
// ismoved = true;
swiper.allowclick = false;
if (data.istouched) {
utils.extend(touches, {
startx: pagex,
starty: pagey,
currentx: pagex,
currenty: pagey,
});
data.touchstarttime = utils.now();
}
return;
}
if (data.istouchevent && params.touchreleaseonedges && !params.loop) {
if (swiper.isvertical()) {
// vertical
if (
(pagey < touches.starty && swiper.translate <= swiper.maxtranslate()) ||
(pagey > touches.starty && swiper.translate >= swiper.mintranslate())
) {
data.istouched = false;
data.ismoved = false;
return;
}
} else if (
(pagex < touches.startx && swiper.translate <= swiper.maxtranslate()) ||
(pagex > touches.startx && swiper.translate >= swiper.mintranslate())
) {
return;
}
}
if (data.istouchevent && doc.activeelement) {
if (e.target === doc.activeelement && $$1(e.target).is(data.formelements)) {
data.ismoved = true;
swiper.allowclick = false;
return;
}
}
if (data.allowtouchcallbacks) {
swiper.emit('touchmove', e);
}
if (e.targettouches && e.targettouches.length > 1) { return; }
touches.currentx = pagex;
touches.currenty = pagey;
var diffx = touches.currentx - touches.startx;
var diffy = touches.currenty - touches.starty;
if (typeof data.isscrolling === 'undefined') {
var touchangle;
if ((swiper.ishorizontal() && touches.currenty === touches.starty) || (swiper.isvertical() && touches.currentx === touches.startx)) {
data.isscrolling = false;
} else {
// eslint-disable-next-line
if ((diffx * diffx) + (diffy * diffy) >= 25) {
touchangle = (math.atan2(math.abs(diffy), math.abs(diffx)) * 180) / math.pi;
data.isscrolling = swiper.ishorizontal() ? touchangle > params.touchangle : (90 - touchangle > params.touchangle);
}
}
}
if (data.isscrolling) {
swiper.emit('touchmoveopposite', e);
}
if (typeof startmoving === 'undefined') {
if (touches.currentx !== touches.startx || touches.currenty !== touches.starty) {
data.startmoving = true;
}
}
if (!data.istouched) { return; }
if (data.isscrolling) {
data.istouched = false;
return;
}
if (!data.startmoving) {
return;
}
swiper.allowclick = false;
e.preventdefault();
if (params.touchmovestoppropagation && !params.nested) {
e.stoppropagation();
}
if (!data.ismoved) {
if (params.loop) {
swiper.loopfix();
}
data.starttranslate = swiper.gettranslate();
swiper.settransition(0);
if (swiper.animating) {
swiper.$wrapperel.trigger('webkittransitionend transitionend');
}
data.allowmomentumbounce = false;
// grab cursor
if (params.grabcursor && (swiper.allowslidenext === true || swiper.allowslideprev === true)) {
swiper.setgrabcursor(true);
}
swiper.emit('sliderfirstmove', e);
}
swiper.emit('slidermove', e);
data.ismoved = true;
var diff = swiper.ishorizontal() ? diffx : diffy;
touches.diff = diff;
diff *= params.touchratio;
if (rtl) { diff = -diff; }
swiper.swipedirection = diff > 0 ? 'prev' : 'next';
data.currenttranslate = diff + data.starttranslate;
var disableparentswiper = true;
var resistanceratio = params.resistanceratio;
if (params.touchreleaseonedges) {
resistanceratio = 0;
}
if ((diff > 0 && data.currenttranslate > swiper.mintranslate())) {
disableparentswiper = false;
if (params.resistance) { data.currenttranslate = (swiper.mintranslate() - 1) + (math.pow( (-swiper.mintranslate() + data.starttranslate + diff), resistanceratio )); }
} else if (diff < 0 && data.currenttranslate < swiper.maxtranslate()) {
disableparentswiper = false;
if (params.resistance) { data.currenttranslate = (swiper.maxtranslate() + 1) - (math.pow( (swiper.maxtranslate() - data.starttranslate - diff), resistanceratio )); }
}
if (disableparentswiper) {
e.preventedbynestedswiper = true;
}
// directions locks
if (!swiper.allowslidenext && swiper.swipedirection === 'next' && data.currenttranslate < data.starttranslate) {
data.currenttranslate = data.starttranslate;
}
if (!swiper.allowslideprev && swiper.swipedirection === 'prev' && data.currenttranslate > data.starttranslate) {
data.currenttranslate = data.starttranslate;
}
// threshold
if (params.threshold > 0) {
if (math.abs(diff) > params.threshold || data.allowthresholdmove) {
if (!data.allowthresholdmove) {
data.allowthresholdmove = true;
touches.startx = touches.currentx;
touches.starty = touches.currenty;
data.currenttranslate = data.starttranslate;
touches.diff = swiper.ishorizontal() ? touches.currentx - touches.startx : touches.currenty - touches.starty;
return;
}
} else {
data.currenttranslate = data.starttranslate;
return;
}
}
if (!params.followfinger) { return; }
// update active index in free mode
if (params.freemode || params.watchslidesprogress || params.watchslidesvisibility) {
swiper.updateactiveindex();
swiper.updateslidesclasses();
}
if (params.freemode) {
// velocity
if (data.velocities.length === 0) {
data.velocities.push({
position: touches[swiper.ishorizontal() ? 'startx' : 'starty'],
time: data.touchstarttime,
});
}
data.velocities.push({
position: touches[swiper.ishorizontal() ? 'currentx' : 'currenty'],
time: utils.now(),
});
}
// update progress
swiper.updateprogress(data.currenttranslate);
// update translate
swiper.settranslate(data.currenttranslate);
};
var ontouchend = function (event) {
var swiper = this;
var data = swiper.toucheventsdata;
var params = swiper.params;
var touches = swiper.touches;
var rtl = swiper.rtl;
var $wrapperel = swiper.$wrapperel;
var slidesgrid = swiper.slidesgrid;
var snapgrid = swiper.snapgrid;
var e = event;
if (e.originalevent) { e = e.originalevent; }
if (data.allowtouchcallbacks) {
swiper.emit('touchend', e);
}
data.allowtouchcallbacks = false;
if (!data.istouched) { return; }
// return grab cursor
if (params.grabcursor && data.ismoved && data.istouched && (swiper.allowslidenext === true || swiper.allowslideprev === true)) {
swiper.setgrabcursor(false);
}
// time diff
var touchendtime = utils.now();
var timediff = touchendtime - data.touchstarttime;
// tap, doubletap, click
if (swiper.allowclick) {
swiper.updateclickedslide(e);
swiper.emit('tap', e);
if (timediff < 300 && (touchendtime - data.lastclicktime) > 300) {
if (data.clicktimeout) { cleartimeout(data.clicktimeout); }
data.clicktimeout = utils.nexttick(function () {
if (!swiper || swiper.destroyed) { return; }
swiper.emit('click', e);
}, 300);
}
if (timediff < 300 && (touchendtime - data.lastclicktime) < 300) {
if (data.clicktimeout) { cleartimeout(data.clicktimeout); }
swiper.emit('doubletap', e);
}
}
data.lastclicktime = utils.now();
utils.nexttick(function () {
if (!swiper.destroyed) { swiper.allowclick = true; }
});
if (!data.istouched || !data.ismoved || !swiper.swipedirection || touches.diff === 0 || data.currenttranslate === data.starttranslate) {
data.istouched = false;
data.ismoved = false;
return;
}
data.istouched = false;
data.ismoved = false;
var currentpos;
if (params.followfinger) {
currentpos = rtl ? swiper.translate : -swiper.translate;
} else {
currentpos = -data.currenttranslate;
}
if (params.freemode) {
if (currentpos < -swiper.mintranslate()) {
swiper.slideto(swiper.activeindex);
return;
} else if (currentpos > -swiper.maxtranslate()) {
if (swiper.slides.length < snapgrid.length) {
swiper.slideto(snapgrid.length - 1);
} else {
swiper.slideto(swiper.slides.length - 1);
}
return;
}
if (params.freemodemomentum) {
if (data.velocities.length > 1) {
var lastmoveevent = data.velocities.pop();
var velocityevent = data.velocities.pop();
var distance = lastmoveevent.position - velocityevent.position;
var time = lastmoveevent.time - velocityevent.time;
swiper.velocity = distance / time;
swiper.velocity /= 2;
if (math.abs(swiper.velocity) < params.freemodeminimumvelocity) {
swiper.velocity = 0;
}
// this implies that the user stopped moving a finger then released.
// there would be no events with distance zero, so the last event is stale.
if (time > 150 || (utils.now() - lastmoveevent.time) > 300) {
swiper.velocity = 0;
}
} else {
swiper.velocity = 0;
}
swiper.velocity *= params.freemodemomentumvelocityratio;
data.velocities.length = 0;
var momentumduration = 1000 * params.freemodemomentumratio;
var momentumdistance = swiper.velocity * momentumduration;
var newposition = swiper.translate + momentumdistance;
if (rtl) { newposition = -newposition; }
var dobounce = false;
var afterbounceposition;
var bounceamount = math.abs(swiper.velocity) * 20 * params.freemodemomentumbounceratio;
if (newposition < swiper.maxtranslate()) {
if (params.freemodemomentumbounce) {
if (newposition + swiper.maxtranslate() < -bounceamount) {
newposition = swiper.maxtranslate() - bounceamount;
}
afterbounceposition = swiper.maxtranslate();
dobounce = true;
data.allowmomentumbounce = true;
} else {
newposition = swiper.maxtranslate();
}
} else if (newposition > swiper.mintranslate()) {
if (params.freemodemomentumbounce) {
if (newposition - swiper.mintranslate() > bounceamount) {
newposition = swiper.mintranslate() + bounceamount;
}
afterbounceposition = swiper.mintranslate();
dobounce = true;
data.allowmomentumbounce = true;
} else {
newposition = swiper.mintranslate();
}
} else if (params.freemodesticky) {
var nextslide;
for (var j = 0; j < snapgrid.length; j += 1) {
if (snapgrid[j] > -newposition) {
nextslide = j;
break;
}
}
if (math.abs(snapgrid[nextslide] - newposition) < math.abs(snapgrid[nextslide - 1] - newposition) || swiper.swipedirection === 'next') {
newposition = snapgrid[nextslide];
} else {
newposition = snapgrid[nextslide - 1];
}
newposition = -newposition;
}
// fix duration
if (swiper.velocity !== 0) {
if (rtl) {
momentumduration = math.abs((-newposition - swiper.translate) / swiper.velocity);
} else {
momentumduration = math.abs((newposition - swiper.translate) / swiper.velocity);
}
} else if (params.freemodesticky) {
swiper.slidereset();
return;
}
if (params.freemodemomentumbounce && dobounce) {
swiper.updateprogress(afterbounceposition);
swiper.settransition(momentumduration);
swiper.settranslate(newposition);
swiper.transitionstart();
swiper.animating = true;
$wrapperel.transitionend(function () {
if (!swiper || swiper.destroyed || !data.allowmomentumbounce) { return; }
swiper.emit('momentumbounce');
swiper.settransition(params.speed);
swiper.settranslate(afterbounceposition);
$wrapperel.transitionend(function () {
if (!swiper || swiper.destroyed) { return; }
swiper.transitionend();
});
});
} else if (swiper.velocity) {
swiper.updateprogress(newposition);
swiper.settransition(momentumduration);
swiper.settranslate(newposition);
swiper.transitionstart();
if (!swiper.animating) {
swiper.animating = true;
$wrapperel.transitionend(function () {
if (!swiper || swiper.destroyed) { return; }
swiper.transitionend();
});
}
} else {
swiper.updateprogress(newposition);
}
swiper.updateactiveindex();
swiper.updateslidesclasses();
}
if (!params.freemodemomentum || timediff >= params.longswipesms) {
swiper.updateprogress();
swiper.updateactiveindex();
swiper.updateslidesclasses();
}
return;
}
// find current slide
var stopindex = 0;
var groupsize = swiper.slidessizesgrid[0];
for (var i = 0; i < slidesgrid.length; i += params.slidespergroup) {
if (typeof slidesgrid[i + params.slidespergroup] !== 'undefined') {
if (currentpos >= slidesgrid[i] && currentpos < slidesgrid[i + params.slidespergroup]) {
stopindex = i;
groupsize = slidesgrid[i + params.slidespergroup] - slidesgrid[i];
}
} else if (currentpos >= slidesgrid[i]) {
stopindex = i;
groupsize = slidesgrid[slidesgrid.length - 1] - slidesgrid[slidesgrid.length - 2];
}
}
// find current slide size
var ratio = (currentpos - slidesgrid[stopindex]) / groupsize;
if (timediff > params.longswipesms) {
// long touches
if (!params.longswipes) {
swiper.slideto(swiper.activeindex);
return;
}
if (swiper.swipedirection === 'next') {
if (ratio >= params.longswipesratio) { swiper.slideto(stopindex + params.slidespergroup); }
else { swiper.slideto(stopindex); }
}
if (swiper.swipedirection === 'prev') {
if (ratio > (1 - params.longswipesratio)) { swiper.slideto(stopindex + params.slidespergroup); }
else { swiper.slideto(stopindex); }
}
} else {
// short swipes
if (!params.shortswipes) {
swiper.slideto(swiper.activeindex);
return;
}
if (swiper.swipedirection === 'next') {
swiper.slideto(stopindex + params.slidespergroup);
}
if (swiper.swipedirection === 'prev') {
swiper.slideto(stopindex);
}
}
};
var onresize = function () {
var swiper = this;
var params = swiper.params;
var el = swiper.el;
if (el && el.offsetwidth === 0) { return; }
// breakpoints
if (params.breakpoints) {
swiper.setbreakpoint();
}
// save locks
var allowslidenext = swiper.allowslidenext;
var allowslideprev = swiper.allowslideprev;
// disable locks on resize
swiper.allowslidenext = true;
swiper.allowslideprev = true;
swiper.updatesize();
swiper.updateslides();
if (params.freemode) {
var newtranslate = math.min(math.max(swiper.translate, swiper.maxtranslate()), swiper.mintranslate());
swiper.settranslate(newtranslate);
swiper.updateactiveindex();
swiper.updateslidesclasses();
if (params.autoheight) {
swiper.updateautoheight();
}
} else {
swiper.updateslidesclasses();
if ((params.slidesperview === 'auto' || params.slidesperview > 1) && swiper.isend && !swiper.params.centeredslides) {
swiper.slideto(swiper.slides.length - 1, 0, false, true);
} else {
swiper.slideto(swiper.activeindex, 0, false, true);
}
}
// return locks after resize
swiper.allowslideprev = allowslideprev;
swiper.allowslidenext = allowslidenext;
};
var onclick = function (e) {
var swiper = this;
if (!swiper.allowclick) {
if (swiper.params.preventclicks) { e.preventdefault(); }
if (swiper.params.preventclickspropagation && swiper.animating) {
e.stoppropagation();
e.stopimmediatepropagation();
}
}
};
function attachevents() {
var swiper = this;
var params = swiper.params;
var touchevents = swiper.touchevents;
var el = swiper.el;
var wrapperel = swiper.wrapperel;
{
swiper.ontouchstart = ontouchstart.bind(swiper);
swiper.ontouchmove = ontouchmove.bind(swiper);
swiper.ontouchend = ontouchend.bind(swiper);
}
swiper.onclick = onclick.bind(swiper);
var target = params.toucheventstarget === 'container' ? el : wrapperel;
var capture = !!params.nested;
// touch events
{
if (browser.ie) {
target.addeventlistener(touchevents.start, swiper.ontouchstart, false);
(support.touch ? target : doc).addeventlistener(touchevents.move, swiper.ontouchmove, capture);
(support.touch ? target : doc).addeventlistener(touchevents.end, swiper.ontouchend, false);
} else {
if (support.touch) {
var passivelistener = touchevents.start === 'touchstart' && support.passivelistener && params.passivelisteners ? { passive: true, capture: false } : false;
target.addeventlistener(touchevents.start, swiper.ontouchstart, passivelistener);
target.addeventlistener(touchevents.move, swiper.ontouchmove, support.passivelistener ? { passive: false, capture: capture } : capture);
target.addeventlistener(touchevents.end, swiper.ontouchend, passivelistener);
}
if ((params.simulatetouch && !device.ios && !device.android) || (params.simulatetouch && !support.touch && device.ios)) {
target.addeventlistener('mousedown', swiper.ontouchstart, false);
doc.addeventlistener('mousemove', swiper.ontouchmove, capture);
doc.addeventlistener('mouseup', swiper.ontouchend, false);
}
}
// prevent links clicks
if (params.preventclicks || params.preventclickspropagation) {
target.addeventlistener('click', swiper.onclick, true);
}
}
// resize handler
swiper.on('resize observerupdate', onresize);
}
function detachevents() {
var swiper = this;
var params = swiper.params;
var touchevents = swiper.touchevents;
var el = swiper.el;
var wrapperel = swiper.wrapperel;
var target = params.toucheventstarget === 'container' ? el : wrapperel;
var capture = !!params.nested;
// touch events
{
if (browser.ie) {
target.removeeventlistener(touchevents.start, swiper.ontouchstart, false);
(support.touch ? target : doc).removeeventlistener(touchevents.move, swiper.ontouchmove, capture);
(support.touch ? target : doc).removeeventlistener(touchevents.end, swiper.ontouchend, false);
} else {
if (support.touch) {
var passivelistener = touchevents.start === 'ontouchstart' && support.passivelistener && params.passivelisteners ? { passive: true, capture: false } : false;
target.removeeventlistener(touchevents.start, swiper.ontouchstart, passivelistener);
target.removeeventlistener(touchevents.move, swiper.ontouchmove, capture);
target.removeeventlistener(touchevents.end, swiper.ontouchend, passivelistener);
}
if ((params.simulatetouch && !device.ios && !device.android) || (params.simulatetouch && !support.touch && device.ios)) {
target.removeeventlistener('mousedown', swiper.ontouchstart, false);
doc.removeeventlistener('mousemove', swiper.ontouchmove, capture);
doc.removeeventlistener('mouseup', swiper.ontouchend, false);
}
}
// prevent links clicks
if (params.preventclicks || params.preventclickspropagation) {
target.removeeventlistener('click', swiper.onclick, true);
}
}
// resize handler
swiper.off('resize observerupdate', onresize);
}
var events = {
attachevents: attachevents,
detachevents: detachevents,
};
var setbreakpoint = function () {
var swiper = this;
var activeindex = swiper.activeindex;
var loopedslides = swiper.loopedslides; if ( loopedslides === void 0 ) loopedslides = 0;
var params = swiper.params;
var breakpoints = params.breakpoints;
if (!breakpoints || (breakpoints && object.keys(breakpoints).length === 0)) { return; }
// set breakpoint for window width and update parameters
var breakpoint = swiper.getbreakpoint(breakpoints);
if (breakpoint && swiper.currentbreakpoint !== breakpoint) {
var breakpointsparams = breakpoint in breakpoints ? breakpoints[breakpoint] : swiper.originalparams;
var needsreloop = params.loop && (breakpointsparams.slidesperview !== params.slidesperview);
utils.extend(swiper.params, breakpointsparams);
utils.extend(swiper, {
allowtouchmove: swiper.params.allowtouchmove,
allowslidenext: swiper.params.allowslidenext,
allowslideprev: swiper.params.allowslideprev,
});
swiper.currentbreakpoint = breakpoint;
if (needsreloop) {
swiper.loopdestroy();
swiper.loopcreate();
swiper.updateslides();
swiper.slideto((activeindex - loopedslides) + swiper.loopedslides, 0, false);
}
swiper.emit('breakpoint', breakpointsparams);
}
};
var getbreakpoint = function (breakpoints) {
// get breakpoint for window width
if (!breakpoints) { return undefined; }
var breakpoint = false;
var points = [];
object.keys(breakpoints).foreach(function (point) {
points.push(point);
});
points.sort(function (a, b) { return parseint(a, 10) - parseint(b, 10); });
for (var i = 0; i < points.length; i += 1) {
var point = points[i];
if (point >= win.innerwidth && !breakpoint) {
breakpoint = point;
}
}
return breakpoint || 'max';
};
var breakpoints = { setbreakpoint: setbreakpoint, getbreakpoint: getbreakpoint };
var addclasses = function () {
var swiper = this;
var classnames = swiper.classnames;
var params = swiper.params;
var rtl = swiper.rtl;
var $el = swiper.$el;
var suffixes = [];
suffixes.push(params.direction);
if (params.freemode) {
suffixes.push('free-mode');
}
if (!support.flexbox) {
suffixes.push('no-flexbox');
}
if (params.autoheight) {
suffixes.push('autoheight');
}
if (rtl) {
suffixes.push('rtl');
}
if (params.slidespercolumn > 1) {
suffixes.push('multirow');
}
if (device.android) {
suffixes.push('android');
}
if (device.ios) {
suffixes.push('ios');
}
// wp8 touch events fix
if (win.navigator.pointerenabled || win.navigator.mspointerenabled) {
suffixes.push(("wp8-" + (params.direction)));
}
suffixes.foreach(function (suffix) {
classnames.push(params.containermodifierclass + suffix);
});
$el.addclass(classnames.join(' '));
};
var removeclasses = function () {
var swiper = this;
var $el = swiper.$el;
var classnames = swiper.classnames;
$el.removeclass(classnames.join(' '));
};
var classes = { addclasses: addclasses, removeclasses: removeclasses };
var loadimage = function (imageel, src, srcset, sizes, checkforcomplete, callback) {
var image;
function onready() {
if (callback) { callback(); }
}
if (!imageel.complete || !checkforcomplete) {
if (src) {
image = new win.image();
image.onload = onready;
image.onerror = onready;
if (sizes) {
image.sizes = sizes;
}
if (srcset) {
image.srcset = srcset;
}
if (src) {
image.src = src;
}
} else {
onready();
}
} else {
// image already loaded...
onready();
}
};
var preloadimages = function () {
var swiper = this;
swiper.imagestoload = swiper.$el.find('img');
function onready() {
if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper.destroyed) { return; }
if (swiper.imagesloaded !== undefined) { swiper.imagesloaded += 1; }
if (swiper.imagesloaded === swiper.imagestoload.length) {
if (swiper.params.updateonimagesready) { swiper.update(); }
swiper.emit('imagesready');
}
}
for (var i = 0; i < swiper.imagestoload.length; i += 1) {
var imageel = swiper.imagestoload[i];
swiper.loadimage(
imageel,
imageel.currentsrc || imageel.getattribute('src'),
imageel.srcset || imageel.getattribute('srcset'),
imageel.sizes || imageel.getattribute('sizes'),
true,
onready
);
}
};
var images = {
loadimage: loadimage,
preloadimages: preloadimages,
};
var defaults = {
init: true,
direction: 'horizontal',
toucheventstarget: 'container',
initialslide: 0,
speed: 300,
// to support ios's swipe-to-go-back gesture (when being used in-app, with uiwebview).
iosedgeswipedetection: false,
iosedgeswipethreshold: 20,
// free mode
freemode: false,
freemodemomentum: true,
freemodemomentumratio: 1,
freemodemomentumbounce: true,
freemodemomentumbounceratio: 1,
freemodemomentumvelocityratio: 1,
freemodesticky: false,
freemodeminimumvelocity: 0.02,
// autoheight
autoheight: false,
// set wrapper width
setwrappersize: false,
// virtual translate
virtualtranslate: false,
// effects
effect: 'slide', // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
// breakpoints
breakpoints: undefined,
// slides grid
spacebetween: 0,
slidesperview: 1,
slidespercolumn: 1,
slidespercolumnfill: 'column',
slidespergroup: 1,
centeredslides: false,
slidesoffsetbefore: 0, // in px
slidesoffsetafter: 0, // in px
normalizeslideindex: true,
// round length
roundlengths: false,
// touches
touchratio: 1,
touchangle: 45,
simulatetouch: true,
shortswipes: true,
longswipes: true,
longswipesratio: 0.5,
longswipesms: 300,
followfinger: true,
allowtouchmove: true,
threshold: 0,
touchmovestoppropagation: true,
touchreleaseonedges: false,
// unique navigation elements
uniquenavelements: true,
// resistance
resistance: true,
resistanceratio: 0.85,
// progress
watchslidesprogress: false,
watchslidesvisibility: false,
// cursor
grabcursor: false,
// clicks
preventclicks: true,
preventclickspropagation: true,
slidetoclickedslide: false,
// images
preloadimages: true,
updateonimagesready: true,
// loop
loop: false,
loopadditionalslides: 0,
loopedslides: null,
loopfillgroupwithblank: false,
// swiping/no swiping
allowslideprev: true,
allowslidenext: true,
swipehandler: null, // '.swipe-handler',
noswiping: true,
noswipingclass: 'swiper-no-swiping',
// passive listeners
passivelisteners: true,
// ns
containermodifierclass: 'swiper-container-', // new
slideclass: 'swiper-slide',
slideblankclass: 'swiper-slide-invisible-blank',
slideactiveclass: 'swiper-slide-active',
slideduplicateactiveclass: 'swiper-slide-duplicate-active',
slidevisibleclass: 'swiper-slide-visible',
slideduplicateclass: 'swiper-slide-duplicate',
slidenextclass: 'swiper-slide-next',
slideduplicatenextclass: 'swiper-slide-duplicate-next',
slideprevclass: 'swiper-slide-prev',
slideduplicateprevclass: 'swiper-slide-duplicate-prev',
wrapperclass: 'swiper-wrapper',
// callbacks
runcallbacksoninit: true,
};
var prototypes = {
update: update,
translate: translate,
transition: transition$1,
slide: slide,
loop: loop,
grabcursor: grabcursor,
manipulation: manipulation,
events: events,
breakpoints: breakpoints,
classes: classes,
images: images,
};
var extendeddefaults = {};
var swiper$1 = (function (swiperclass$$1) {
function swiper() {
var args = [], len = arguments.length;
while ( len-- ) args[ len ] = arguments[ len ];
var el;
var params;
if (args.length === 1 && args[0].constructor && args[0].constructor === object) {
params = args[0];
} else {
var assign;
(assign = args, el = assign[0], params = assign[1]);
}
if (!params) { params = {}; }
params = utils.extend({}, params);
if (el && !params.el) { params.el = el; }
swiperclass$$1.call(this, params);
object.keys(prototypes).foreach(function (prototypegroup) {
object.keys(prototypes[prototypegroup]).foreach(function (protomethod) {
if (!swiper.prototype[protomethod]) {
swiper.prototype[protomethod] = prototypes[prototypegroup][protomethod];
}
});
});
// swiper instance
var swiper = this;
if (typeof swiper.modules === 'undefined') {
swiper.modules = {};
}
object.keys(swiper.modules).foreach(function (modulename) {
var module = swiper.modules[modulename];
if (module.params) {
var moduleparamname = object.keys(module.params)[0];
var moduleparams = module.params[moduleparamname];
if (typeof moduleparams !== 'object') { return; }
if (!(moduleparamname in params && 'enabled' in moduleparams)) { return; }
if (params[moduleparamname] === true) {
params[moduleparamname] = { enabled: true };
}
if (
typeof params[moduleparamname] === 'object' &&
!('enabled' in params[moduleparamname])
) {
params[moduleparamname].enabled = true;
}
if (!params[moduleparamname]) { params[moduleparamname] = { enabled: false }; }
}
});
// extend defaults with modules params
var swiperparams = utils.extend({}, defaults);
swiper.usemodulesparams(swiperparams);
// extend defaults with passed params
swiper.params = utils.extend({}, swiperparams, extendeddefaults, params);
swiper.originalparams = utils.extend({}, swiper.params);
swiper.passedparams = utils.extend({}, params);
// find el
var $el = $$1(swiper.params.el);
el = $el[0];
if (!el) {
return undefined;
}
if ($el.length > 1) {
var swipers = [];
$el.each(function (index, containerel) {
var newparams = utils.extend({}, params, { el: containerel });
swipers.push(new swiper(newparams));
});
return swipers;
}
el.swiper = swiper;
$el.data('swiper', swiper);
// find wrapper
var $wrapperel = $el.children(("." + (swiper.params.wrapperclass)));
// extend swiper
utils.extend(swiper, {
$el: $el,
el: el,
$wrapperel: $wrapperel,
wrapperel: $wrapperel[0],
// classes
classnames: [],
// slides
slides: $$1(),
slidesgrid: [],
snapgrid: [],
slidessizesgrid: [],
// isdirection
ishorizontal: function ishorizontal() {
return swiper.params.direction === 'horizontal';
},
isvertical: function isvertical() {
return swiper.params.direction === 'vertical';
},
// rtl
rtl: swiper.params.direction === 'horizontal' && (el.dir.tolowercase() === 'rtl' || $el.css('direction') === 'rtl'),
wrongrtl: $wrapperel.css('display') === '-webkit-box',
// indexes
activeindex: 0,
realindex: 0,
//
isbeginning: true,
isend: false,
// props
translate: 0,
progress: 0,
velocity: 0,
animating: false,
// locks
allowslidenext: swiper.params.allowslidenext,
allowslideprev: swiper.params.allowslideprev,
// touch events
touchevents: (function touchevents() {
var touch = ['touchstart', 'touchmove', 'touchend'];
var desktop = ['mousedown', 'mousemove', 'mouseup'];
if (win.navigator.pointerenabled) {
desktop = ['pointerdown', 'pointermove', 'pointerup'];
} else if (win.navigator.mspointerenabled) {
desktop = ['mspointerdown', 'mspointermove', 'mspointerup'];
}
return {
start: support.touch || !swiper.params.simulatetouch ? touch[0] : desktop[0],
move: support.touch || !swiper.params.simulatetouch ? touch[1] : desktop[1],
end: support.touch || !swiper.params.simulatetouch ? touch[2] : desktop[2],
};
}()),
toucheventsdata: {
istouched: undefined,
ismoved: undefined,
allowtouchcallbacks: undefined,
touchstarttime: undefined,
isscrolling: undefined,
currenttranslate: undefined,
starttranslate: undefined,
allowthresholdmove: undefined,
// form elements to match
formelements: 'input, select, option, textarea, button, video',
// last click time
lastclicktime: utils.now(),
clicktimeout: undefined,
// velocities
velocities: [],
allowmomentumbounce: undefined,
istouchevent: undefined,
startmoving: undefined,
},
// clicks
allowclick: true,
// touches
allowtouchmove: swiper.params.allowtouchmove,
touches: {
startx: 0,
starty: 0,
currentx: 0,
currenty: 0,
diff: 0,
},
// images
imagestoload: [],
imagesloaded: 0,
});
// install modules
swiper.usemodules();
// init
if (swiper.params.init) {
swiper.init();
}
// return app instance
return swiper;
}
if ( swiperclass$$1 ) swiper.__proto__ = swiperclass$$1;
swiper.prototype = object.create( swiperclass$$1 && swiperclass$$1.prototype );
swiper.prototype.constructor = swiper;
var staticaccessors = { extendeddefaults: {},defaults: {},class: {},$: {} };
swiper.prototype.slidesperviewdynamic = function slidesperviewdynamic () {
var swiper = this;
var params = swiper.params;
var slides = swiper.slides;
var slidesgrid = swiper.slidesgrid;
var swipersize = swiper.size;
var activeindex = swiper.activeindex;
var spv = 1;
if (params.centeredslides) {
var slidesize = slides[activeindex].swiperslidesize;
var breakloop;
for (var i = activeindex + 1; i < slides.length; i += 1) {
if (slides[i] && !breakloop) {
slidesize += slides[i].swiperslidesize;
spv += 1;
if (slidesize > swipersize) { breakloop = true; }
}
}
for (var i$1 = activeindex - 1; i$1 >= 0; i$1 -= 1) {
if (slides[i$1] && !breakloop) {
slidesize += slides[i$1].swiperslidesize;
spv += 1;
if (slidesize > swipersize) { breakloop = true; }
}
}
} else {
for (var i$2 = activeindex + 1; i$2 < slides.length; i$2 += 1) {
if (slidesgrid[i$2] - slidesgrid[activeindex] < swipersize) {
spv += 1;
}
}
}
return spv;
};
swiper.prototype.update = function update$$1 () {
var swiper = this;
if (!swiper || swiper.destroyed) { return; }
swiper.updatesize();
swiper.updateslides();
swiper.updateprogress();
swiper.updateslidesclasses();
var newtranslate;
function settranslate() {
newtranslate = math.min(math.max(swiper.translate, swiper.maxtranslate()), swiper.mintranslate());
swiper.settranslate(newtranslate);
swiper.updateactiveindex();
swiper.updateslidesclasses();
}
var translated;
if (swiper.params.freemode) {
settranslate();
if (swiper.params.autoheight) {
swiper.updateautoheight();
}
} else {
if ((swiper.params.slidesperview === 'auto' || swiper.params.slidesperview > 1) && swiper.isend && !swiper.params.centeredslides) {
translated = swiper.slideto(swiper.slides.length - 1, 0, false, true);
} else {
translated = swiper.slideto(swiper.activeindex, 0, false, true);
}
if (!translated) {
settranslate();
}
}
swiper.emit('update');
};
swiper.prototype.init = function init () {
var swiper = this;
if (swiper.initialized) { return; }
swiper.emit('beforeinit');
// set breakpoint
if (swiper.params.breakpoints) {
swiper.setbreakpoint();
}
// add classes
swiper.addclasses();
// create loop
if (swiper.params.loop) {
swiper.loopcreate();
}
// update size
swiper.updatesize();
// update slides
swiper.updateslides();
// set grab cursor
if (swiper.params.grabcursor) {
swiper.setgrabcursor();
}
if (swiper.params.preloadimages) {
swiper.preloadimages();
}
// slide to initial slide
if (swiper.params.loop) {
swiper.slideto(swiper.params.initialslide + swiper.loopedslides, 0, swiper.params.runcallbacksoninit);
} else {
swiper.slideto(swiper.params.initialslide, 0, swiper.params.runcallbacksoninit);
}
// attach events
swiper.attachevents();
// init flag
swiper.initialized = true;
// emit
swiper.emit('init');
};
swiper.prototype.destroy = function destroy (deleteinstance, cleanstyles) {
if ( deleteinstance === void 0 ) deleteinstance = true;
if ( cleanstyles === void 0 ) cleanstyles = true;
var swiper = this;
var params = swiper.params;
var $el = swiper.$el;
var $wrapperel = swiper.$wrapperel;
var slides = swiper.slides;
swiper.emit('beforedestroy');
// init flag
swiper.initialized = false;
// detach events
swiper.detachevents();
// destroy loop
if (params.loop) {
swiper.loopdestroy();
}
// cleanup styles
if (cleanstyles) {
swiper.removeclasses();
$el.removeattr('style');
$wrapperel.removeattr('style');
if (slides && slides.length) {
slides
.removeclass([
params.slidevisibleclass,
params.slideactiveclass,
params.slidenextclass,
params.slideprevclass ].join(' '))
.removeattr('style')
.removeattr('data-swiper-slide-index')
.removeattr('data-swiper-column')
.removeattr('data-swiper-row');
}
}
swiper.emit('destroy');
// detach emitter events
object.keys(swiper.eventslisteners).foreach(function (eventname) {
swiper.off(eventname);
});
if (deleteinstance !== false) {
swiper.$el[0].swiper = null;
swiper.$el.data('swiper', null);
utils.deleteprops(swiper);
}
swiper.destroyed = true;
};
swiper.extenddefaults = function extenddefaults (newdefaults) {
utils.extend(extendeddefaults, newdefaults);
};
staticaccessors.extendeddefaults.get = function () {
return extendeddefaults;
};
staticaccessors.defaults.get = function () {
return defaults;
};
staticaccessors.class.get = function () {
return swiperclass$$1;
};
staticaccessors.$.get = function () {
return $$1;
};
object.defineproperties( swiper, staticaccessors );
return swiper;
}(swiperclass));
var device$2 = {
name: 'device',
proto: {
device: device,
},
static: {
device: device,
},
};
var support$2 = {
name: 'support',
proto: {
support: support,
},
static: {
support: support,
},
};
var browser$2 = {
name: 'browser',
proto: {
browser: browser,
},
static: {
browser: browser,
},
};
var resize = {
name: 'resize',
create: function create() {
var swiper = this;
utils.extend(swiper, {
resize: {
resizehandler: function resizehandler() {
if (!swiper || swiper.destroyed || !swiper.initialized) { return; }
swiper.emit('beforeresize');
swiper.emit('resize');
},
orientationchangehandler: function orientationchangehandler() {
if (!swiper || swiper.destroyed || !swiper.initialized) { return; }
swiper.emit('orientationchange');
},
},
});
},
on: {
init: function init() {
var swiper = this;
// emit resize
win.addeventlistener('resize', swiper.resize.resizehandler);
// emit orientationchange
win.addeventlistener('orientationchange', swiper.resize.orientationchangehandler);
},
destroy: function destroy() {
var swiper = this;
win.removeeventlistener('resize', swiper.resize.resizehandler);
win.removeeventlistener('orientationchange', swiper.resize.orientationchangehandler);
},
},
};
var observer = {
func: win.mutationobserver || win.webkitmutationobserver,
attach: function attach(target, options) {
if ( options === void 0 ) options = {};
var swiper = this;
var observerfunc = observer.func;
var observer = new observerfunc(function (mutations) {
mutations.foreach(function (mutation) {
swiper.emit('observerupdate', mutation);
});
});
observer.observe(target, {
attributes: typeof options.attributes === 'undefined' ? true : options.attributes,
childlist: typeof options.childlist === 'undefined' ? true : options.childlist,
characterdata: typeof options.characterdata === 'undefined' ? true : options.characterdata,
});
swiper.observer.observers.push(observer);
},
init: function init() {
var swiper = this;
if (!support.observer || !swiper.params.observer) { return; }
if (swiper.params.observeparents) {
var containerparents = swiper.$el.parents();
for (var i = 0; i < containerparents.length; i += 1) {
swiper.observer.attach(containerparents[i]);
}
}
// observe container
swiper.observer.attach(swiper.$el[0], { childlist: false });
// observe wrapper
swiper.observer.attach(swiper.$wrapperel[0], { attributes: false });
},
destroy: function destroy() {
var swiper = this;
swiper.observer.observers.foreach(function (observer) {
observer.disconnect();
});
swiper.observer.observers = [];
},
};
var observer$1 = {
name: 'observer',
params: {
observer: false,
observeparents: false,
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
observer: {
init: observer.init.bind(swiper),
attach: observer.attach.bind(swiper),
destroy: observer.destroy.bind(swiper),
observers: [],
},
});
},
on: {
init: function init() {
var swiper = this;
swiper.observer.init();
},
destroy: function destroy() {
var swiper = this;
swiper.observer.destroy();
},
},
};
var virtual = {
update: function update(force) {
var swiper = this;
var ref = swiper.params;
var slidesperview = ref.slidesperview;
var slidespergroup = ref.slidespergroup;
var centeredslides = ref.centeredslides;
var ref$1 = swiper.virtual;
var previousfrom = ref$1.from;
var previousto = ref$1.to;
var slides = ref$1.slides;
var previousslidesgrid = ref$1.slidesgrid;
var renderslide = ref$1.renderslide;
var previousoffset = ref$1.offset;
swiper.updateactiveindex();
var activeindex = swiper.activeindex || 0;
var offsetprop;
if (swiper.rtl && swiper.ishorizontal()) { offsetprop = 'right'; }
else { offsetprop = swiper.ishorizontal() ? 'left' : 'top'; }
var slidesafter;
var slidesbefore;
if (centeredslides) {
slidesafter = math.floor(slidesperview / 2) + slidespergroup;
slidesbefore = math.floor(slidesperview / 2) + slidespergroup;
} else {
slidesafter = slidesperview + (slidespergroup - 1);
slidesbefore = slidespergroup;
}
var from = math.max((activeindex || 0) - slidesbefore, 0);
var to = math.min((activeindex || 0) + slidesafter, slides.length - 1);
var offset = (swiper.slidesgrid[from] || 0) - (swiper.slidesgrid[0] || 0);
utils.extend(swiper.virtual, {
from: from,
to: to,
offset: offset,
slidesgrid: swiper.slidesgrid,
});
function onrendered() {
swiper.updateslides();
swiper.updateprogress();
swiper.updateslidesclasses();
if (swiper.lazy && swiper.params.lazy.enabled) {
swiper.lazy.load();
}
}
if (previousfrom === from && previousto === to && !force) {
if (swiper.slidesgrid !== previousslidesgrid && offset !== previousoffset) {
swiper.slides.css(offsetprop, (offset + "px"));
}
swiper.updateprogress();
return;
}
if (swiper.params.virtual.renderexternal) {
swiper.params.virtual.renderexternal.call(swiper, {
offset: offset,
from: from,
to: to,
slides: (function getslides() {
var slidestorender = [];
for (var i = from; i <= to; i += 1) {
slidestorender.push(slides[i]);
}
return slidestorender;
}()),
});
onrendered();
return;
}
var prependindexes = [];
var appendindexes = [];
if (force) {
swiper.$wrapperel.find(("." + (swiper.params.slideclass))).remove();
} else {
for (var i = previousfrom; i <= previousto; i += 1) {
if (i < from || i > to) {
swiper.$wrapperel.find(("." + (swiper.params.slideclass) + "[data-swiper-slide-index=\"" + i + "\"]")).remove();
}
}
}
for (var i$1 = 0; i$1 < slides.length; i$1 += 1) {
if (i$1 >= from && i$1 <= to) {
if (typeof previousto === 'undefined' || force) {
appendindexes.push(i$1);
} else {
if (i$1 > previousto) { appendindexes.push(i$1); }
if (i$1 < previousfrom) { prependindexes.push(i$1); }
}
}
}
appendindexes.foreach(function (index) {
swiper.$wrapperel.append(renderslide(slides[index], index));
});
prependindexes.sort(function (a, b) { return a < b; }).foreach(function (index) {
swiper.$wrapperel.prepend(renderslide(slides[index], index));
});
swiper.$wrapperel.children('.swiper-slide').css(offsetprop, (offset + "px"));
onrendered();
},
renderslide: function renderslide(slide, index) {
var swiper = this;
var params = swiper.params.virtual;
if (params.cache && swiper.virtual.cache[index]) {
return swiper.virtual.cache[index];
}
var $slideel = params.renderslide
? $$1(params.renderslide.call(swiper, slide, index))
: $$1(("" + slide + "
"));
if (!$slideel.attr('data-swiper-slide-index')) { $slideel.attr('data-swiper-slide-index', index); }
if (params.cache) { swiper.virtual.cache[index] = $slideel; }
return $slideel;
},
appendslide: function appendslide(slide) {
var swiper = this;
swiper.virtual.slides.push(slide);
swiper.virtual.update(true);
},
prependslide: function prependslide(slide) {
var swiper = this;
swiper.virtual.slides.unshift(slide);
if (swiper.params.virtual.cache) {
var cache = swiper.virtual.cache;
var newcache = {};
object.keys(cache).foreach(function (cachedindex) {
newcache[cachedindex + 1] = cache[cachedindex];
});
swiper.virtual.cache = newcache;
}
swiper.virtual.update(true);
swiper.slidenext(0);
},
};
var virtual$1 = {
name: 'virtual',
params: {
virtual: {
enabled: false,
slides: [],
cache: true,
renderslide: null,
renderexternal: null,
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
virtual: {
update: virtual.update.bind(swiper),
appendslide: virtual.appendslide.bind(swiper),
prependslide: virtual.prependslide.bind(swiper),
renderslide: virtual.renderslide.bind(swiper),
slides: swiper.params.virtual.slides,
cache: {},
},
});
},
on: {
beforeinit: function beforeinit() {
var swiper = this;
if (!swiper.params.virtual.enabled) { return; }
swiper.classnames.push(((swiper.params.containermodifierclass) + "virtual"));
var overwriteparams = {
watchslidesprogress: true,
};
utils.extend(swiper.params, overwriteparams);
utils.extend(swiper.originalparams, overwriteparams);
swiper.virtual.update();
},
settranslate: function settranslate() {
var swiper = this;
if (!swiper.params.virtual.enabled) { return; }
swiper.virtual.update();
},
},
};
var keyboard = {
handle: function handle(event) {
var swiper = this;
var e = event;
if (e.originalevent) { e = e.originalevent; } // jquery fix
var kc = e.keycode || e.charcode;
// directions locks
if (!swiper.allowslidenext && ((swiper.ishorizontal() && kc === 39) || (swiper.isvertical() && kc === 40))) {
return false;
}
if (!swiper.allowslideprev && ((swiper.ishorizontal() && kc === 37) || (swiper.isvertical() && kc === 38))) {
return false;
}
if (e.shiftkey || e.altkey || e.ctrlkey || e.metakey) {
return undefined;
}
if (doc.activeelement && doc.activeelement.nodename && (doc.activeelement.nodename.tolowercase() === 'input' || doc.activeelement.nodename.tolowercase() === 'textarea')) {
return undefined;
}
if (kc === 37 || kc === 39 || kc === 38 || kc === 40) {
var inview = false;
// check that swiper should be inside of visible area of window
if (swiper.$el.parents(("." + (swiper.params.slideclass))).length > 0 && swiper.$el.parents(("." + (swiper.params.slideactiveclass))).length === 0) {
return undefined;
}
var windowscroll = {
left: win.pagexoffset,
top: win.pageyoffset,
};
var windowwidth = win.innerwidth;
var windowheight = win.innerheight;
var swiperoffset = swiper.$el.offset();
if (swiper.rtl) { swiperoffset.left -= swiper.$el[0].scrollleft; }
var swipercoord = [
[swiperoffset.left, swiperoffset.top],
[swiperoffset.left + swiper.width, swiperoffset.top],
[swiperoffset.left, swiperoffset.top + swiper.height],
[swiperoffset.left + swiper.width, swiperoffset.top + swiper.height] ];
for (var i = 0; i < swipercoord.length; i += 1) {
var point = swipercoord[i];
if (
point[0] >= windowscroll.left && point[0] <= windowscroll.left + windowwidth &&
point[1] >= windowscroll.top && point[1] <= windowscroll.top + windowheight
) {
inview = true;
}
}
if (!inview) { return undefined; }
}
if (swiper.ishorizontal()) {
if (kc === 37 || kc === 39) {
if (e.preventdefault) { e.preventdefault(); }
else { e.returnvalue = false; }
}
if ((kc === 39 && !swiper.rtl) || (kc === 37 && swiper.rtl)) { swiper.slidenext(); }
if ((kc === 37 && !swiper.rtl) || (kc === 39 && swiper.rtl)) { swiper.slideprev(); }
} else {
if (kc === 38 || kc === 40) {
if (e.preventdefault) { e.preventdefault(); }
else { e.returnvalue = false; }
}
if (kc === 40) { swiper.slidenext(); }
if (kc === 38) { swiper.slideprev(); }
}
swiper.emit('keypress', kc);
return undefined;
},
enable: function enable() {
var swiper = this;
if (swiper.keyboard.enabled) { return; }
$$1(doc).on('keydown', swiper.keyboard.handle);
swiper.keyboard.enabled = true;
},
disable: function disable() {
var swiper = this;
if (!swiper.keyboard.enabled) { return; }
$$1(doc).off('keydown', swiper.keyboard.handle);
swiper.keyboard.enabled = false;
},
};
var keyboard$1 = {
name: 'keyboard',
params: {
keyboard: {
enabled: false,
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
keyboard: {
enabled: false,
enable: keyboard.enable.bind(swiper),
disable: keyboard.disable.bind(swiper),
handle: keyboard.handle.bind(swiper),
},
});
},
on: {
init: function init() {
var swiper = this;
if (swiper.params.keyboard.enabled) {
swiper.keyboard.enable();
}
},
destroy: function destroy() {
var swiper = this;
if (swiper.keyboard.enabled) {
swiper.keyboard.disable();
}
},
},
};
function iseventsupported() {
var eventname = 'onwheel';
var issupported = eventname in doc;
if (!issupported) {
var element = doc.createelement('div');
element.setattribute(eventname, 'return;');
issupported = typeof element[eventname] === 'function';
}
if (!issupported &&
doc.implementation &&
doc.implementation.hasfeature &&
// always returns true in newer browsers as per the standard.
// @see http://dom.spec.whatwg.org/#dom-domimplementation-hasfeature
doc.implementation.hasfeature('', '') !== true
) {
// this is the only way to test support for the `wheel` event in ie9+.
issupported = doc.implementation.hasfeature('events.wheel', '3.0');
}
return issupported;
}
var mousewheel = {
lastscrolltime: utils.now(),
event: (function getevent() {
if (win.navigator.useragent.indexof('firefox') > -1) { return 'dommousescroll'; }
return iseventsupported() ? 'wheel' : 'mousewheel';
}()),
normalize: function normalize(e) {
// reasonable defaults
var pixel_step = 10;
var line_height = 40;
var page_height = 800;
var sx = 0;
var sy = 0; // spinx, spiny
var px = 0;
var py = 0; // pixelx, pixely
// legacy
if ('detail' in e) {
sy = e.detail;
}
if ('wheeldelta' in e) {
sy = -e.wheeldelta / 120;
}
if ('wheeldeltay' in e) {
sy = -e.wheeldeltay / 120;
}
if ('wheeldeltax' in e) {
sx = -e.wheeldeltax / 120;
}
// side scrolling on ff with dommousescroll
if ('axis' in e && e.axis === e.horizontal_axis) {
sx = sy;
sy = 0;
}
px = sx * pixel_step;
py = sy * pixel_step;
if ('deltay' in e) {
py = e.deltay;
}
if ('deltax' in e) {
px = e.deltax;
}
if ((px || py) && e.deltamode) {
if (e.deltamode === 1) { // delta in line units
px *= line_height;
py *= line_height;
} else { // delta in page units
px *= page_height;
py *= page_height;
}
}
// fall-back if spin cannot be determined
if (px && !sx) {
sx = (px < 1) ? -1 : 1;
}
if (py && !sy) {
sy = (py < 1) ? -1 : 1;
}
return {
spinx: sx,
spiny: sy,
pixelx: px,
pixely: py,
};
},
handle: function handle(event) {
var e = event;
var swiper = this;
var params = swiper.params.mousewheel;
if (e.originalevent) { e = e.originalevent; } // jquery fix
var delta = 0;
var rtlfactor = swiper.rtl ? -1 : 1;
var data = mousewheel.normalize(e);
if (params.forcetoaxis) {
if (swiper.ishorizontal()) {
if (math.abs(data.pixelx) > math.abs(data.pixely)) { delta = data.pixelx * rtlfactor; }
else { return true; }
} else if (math.abs(data.pixely) > math.abs(data.pixelx)) { delta = data.pixely; }
else { return true; }
} else {
delta = math.abs(data.pixelx) > math.abs(data.pixely) ? -data.pixelx * rtlfactor : -data.pixely;
}
if (delta === 0) { return true; }
if (params.invert) { delta = -delta; }
if (!swiper.params.freemode) {
if (utils.now() - swiper.mousewheel.lastscrolltime > 60) {
if (delta < 0) {
if ((!swiper.isend || swiper.params.loop) && !swiper.animating) {
swiper.slidenext();
swiper.emit('scroll', e);
} else if (params.releaseonedges) { return true; }
} else if ((!swiper.isbeginning || swiper.params.loop) && !swiper.animating) {
swiper.slideprev();
swiper.emit('scroll', e);
} else if (params.releaseonedges) { return true; }
}
swiper.mousewheel.lastscrolltime = (new win.date()).gettime();
} else {
// freemode or scrollcontainer:
var position = swiper.gettranslate() + (delta * params.sensitivity);
var wasbeginning = swiper.isbeginning;
var wasend = swiper.isend;
if (position >= swiper.mintranslate()) { position = swiper.mintranslate(); }
if (position <= swiper.maxtranslate()) { position = swiper.maxtranslate(); }
swiper.settransition(0);
swiper.settranslate(position);
swiper.updateprogress();
swiper.updateactiveindex();
swiper.updateslidesclasses();
if ((!wasbeginning && swiper.isbeginning) || (!wasend && swiper.isend)) {
swiper.updateslidesclasses();
}
if (swiper.params.freemodesticky) {
cleartimeout(swiper.mousewheel.timeout);
swiper.mousewheel.timeout = utils.nexttick(function () {
swiper.slidereset();
}, 300);
}
// emit event
swiper.emit('scroll', e);
// stop autoplay
if (swiper.params.autoplay && swiper.params.autoplaydisableoninteraction) { swiper.stopautoplay(); }
// return page scroll on edge positions
if (position === 0 || position === swiper.maxtranslate()) { return true; }
}
if (e.preventdefault) { e.preventdefault(); }
else { e.returnvalue = false; }
return false;
},
enable: function enable() {
var swiper = this;
if (!mousewheel.event) { return false; }
if (swiper.mousewheel.enabled) { return false; }
var target = swiper.$el;
if (swiper.params.mousewheel.eventstarged !== 'container') {
target = $$1(swiper.params.mousewheel.eventstarged);
}
target.on(mousewheel.event, swiper.mousewheel.handle);
swiper.mousewheel.enabled = true;
return true;
},
disable: function disable() {
var swiper = this;
if (!mousewheel.event) { return false; }
if (!swiper.mousewheel.enabled) { return false; }
var target = swiper.$el;
if (swiper.params.mousewheel.eventstarged !== 'container') {
target = $$1(swiper.params.mousewheel.eventstarged);
}
target.off(mousewheel.event, swiper.mousewheel.handle);
swiper.mousewheel.enabled = false;
return true;
},
};
var mousewheel$1 = {
name: 'mousewheel',
params: {
mousewheel: {
enabled: false,
releaseonedges: false,
invert: false,
forcetoaxis: false,
sensitivity: 1,
eventstarged: 'container',
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
mousewheel: {
enabled: false,
enable: mousewheel.enable.bind(swiper),
disable: mousewheel.disable.bind(swiper),
handle: mousewheel.handle.bind(swiper),
lastscrolltime: utils.now(),
},
});
},
on: {
init: function init() {
var swiper = this;
if (swiper.params.mousewheel.enabled) { swiper.mousewheel.enable(); }
},
destroy: function destroy() {
var swiper = this;
if (swiper.mousewheel.enabled) { swiper.mousewheel.disable(); }
},
},
};
var navigation = {
update: function update() {
// update navigation buttons
var swiper = this;
var params = swiper.params.navigation;
if (swiper.params.loop) { return; }
var ref = swiper.navigation;
var $nextel = ref.$nextel;
var $prevel = ref.$prevel;
if ($prevel && $prevel.length > 0) {
if (swiper.isbeginning) {
$prevel.addclass(params.disabledclass);
} else {
$prevel.removeclass(params.disabledclass);
}
}
if ($nextel && $nextel.length > 0) {
if (swiper.isend) {
$nextel.addclass(params.disabledclass);
} else {
$nextel.removeclass(params.disabledclass);
}
}
},
init: function init() {
var swiper = this;
var params = swiper.params.navigation;
if (!(params.nextel || params.prevel)) { return; }
var $nextel;
var $prevel;
if (params.nextel) {
$nextel = $$1(params.nextel);
if (
swiper.params.uniquenavelements &&
typeof params.nextel === 'string' &&
$nextel.length > 1 &&
swiper.$el.find(params.nextel).length === 1
) {
$nextel = swiper.$el.find(params.nextel);
}
}
if (params.prevel) {
$prevel = $$1(params.prevel);
if (
swiper.params.uniquenavelements &&
typeof params.prevel === 'string' &&
$prevel.length > 1 &&
swiper.$el.find(params.prevel).length === 1
) {
$prevel = swiper.$el.find(params.prevel);
}
}
if ($nextel && $nextel.length > 0) {
$nextel.on('click', function (e) {
e.preventdefault();
if (swiper.isend && !swiper.params.loop) { return; }
swiper.slidenext();
});
}
if ($prevel && $prevel.length > 0) {
$prevel.on('click', function (e) {
e.preventdefault();
if (swiper.isbeginning && !swiper.params.loop) { return; }
swiper.slideprev();
});
}
utils.extend(swiper.navigation, {
$nextel: $nextel,
nextel: $nextel && $nextel[0],
$prevel: $prevel,
prevel: $prevel && $prevel[0],
});
},
destroy: function destroy() {
var swiper = this;
var ref = swiper.navigation;
var $nextel = ref.$nextel;
var $prevel = ref.$prevel;
if ($nextel && $nextel.length) {
$nextel.off('click');
$nextel.removeclass(swiper.params.navigation.disabledclass);
}
if ($prevel && $prevel.length) {
$prevel.off('click');
$prevel.removeclass(swiper.params.navigation.disabledclass);
}
},
};
var navigation$1 = {
name: 'navigation',
params: {
navigation: {
nextel: null,
prevel: null,
hideonclick: false,
disabledclass: 'swiper-button-disabled',
hiddenclass: 'swiper-button-hidden',
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
navigation: {
init: navigation.init.bind(swiper),
update: navigation.update.bind(swiper),
destroy: navigation.destroy.bind(swiper),
},
});
},
on: {
init: function init() {
var swiper = this;
swiper.navigation.init();
swiper.navigation.update();
},
toedge: function toedge() {
var swiper = this;
swiper.navigation.update();
},
fromedge: function fromedge() {
var swiper = this;
swiper.navigation.update();
},
destroy: function destroy() {
var swiper = this;
swiper.navigation.destroy();
},
click: function click(e) {
var swiper = this;
var ref = swiper.navigation;
var $nextel = ref.$nextel;
var $prevel = ref.$prevel;
if (
swiper.params.navigation.hideonclick &&
!$$1(e.target).is($prevel) &&
!$$1(e.target).is($nextel)
) {
if ($nextel) { $nextel.toggleclass(swiper.params.navigation.hiddenclass); }
if ($prevel) { $prevel.toggleclass(swiper.params.navigation.hiddenclass); }
}
},
},
};
var pagination = {
update: function update() {
// render || update pagination bullets/items
var swiper = this;
var rtl = swiper.rtl;
var params = swiper.params.pagination;
if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) { return; }
var slideslength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
var $el = swiper.pagination.$el;
// current/total
var current;
var total = swiper.params.loop ? math.ceil((slideslength - (swiper.loopedslides * 2)) / swiper.params.slidespergroup) : swiper.snapgrid.length;
if (swiper.params.loop) {
current = math.ceil((swiper.activeindex - swiper.loopedslides) / swiper.params.slidespergroup);
if (current > slideslength - 1 - (swiper.loopedslides * 2)) {
current -= (slideslength - (swiper.loopedslides * 2));
}
if (current > total - 1) { current -= total; }
if (current < 0 && swiper.params.paginationtype !== 'bullets') { current = total + current; }
} else if (typeof swiper.snapindex !== 'undefined') {
current = swiper.snapindex;
} else {
current = swiper.activeindex || 0;
}
// types
if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) {
var bullets = swiper.pagination.bullets;
if (params.dynamicbullets) {
swiper.pagination.bulletsize = bullets.eq(0)[swiper.ishorizontal() ? 'outerwidth' : 'outerheight'](true);
$el.css(swiper.ishorizontal() ? 'width' : 'height', ((swiper.pagination.bulletsize * 5) + "px"));
}
bullets.removeclass(((params.bulletactiveclass) + " " + (params.bulletactiveclass) + "-next " + (params.bulletactiveclass) + "-next-next " + (params.bulletactiveclass) + "-prev " + (params.bulletactiveclass) + "-prev-prev"));
if ($el.length > 1) {
bullets.each(function (index, bullet) {
var $bullet = $$1(bullet);
if ($bullet.index() === current) {
$bullet.addclass(params.bulletactiveclass);
if (params.dynamicbullets) {
$bullet
.prev()
.addclass(((params.bulletactiveclass) + "-prev"))
.prev()
.addclass(((params.bulletactiveclass) + "-prev-prev"));
$bullet
.next()
.addclass(((params.bulletactiveclass) + "-next"))
.next()
.addclass(((params.bulletactiveclass) + "-next-next"));
}
}
});
} else {
var $bullet = bullets.eq(current);
$bullet.addclass(params.bulletactiveclass);
if (params.dynamicbullets) {
$bullet
.prev()
.addclass(((params.bulletactiveclass) + "-prev"))
.prev()
.addclass(((params.bulletactiveclass) + "-prev-prev"));
$bullet
.next()
.addclass(((params.bulletactiveclass) + "-next"))
.next()
.addclass(((params.bulletactiveclass) + "-next-next"));
}
}
if (params.dynamicbullets) {
var dynamicbulletslength = math.min(bullets.length, 5);
var bulletsoffset = (((swiper.pagination.bulletsize * dynamicbulletslength) - (swiper.pagination.bulletsize)) / 2) - (current * swiper.pagination.bulletsize);
var offsetprop = rtl ? 'right' : 'left';
bullets.css(swiper.ishorizontal() ? offsetprop : 'top', (bulletsoffset + "px"));
}
}
if (params.type === 'fraction') {
$el.find(("." + (params.currentclass))).text(current + 1);
$el.find(("." + (params.totalclass))).text(total);
}
if (params.type === 'progressbar') {
var scale = (current + 1) / total;
var scalex = scale;
var scaley = 1;
if (!swiper.ishorizontal()) {
scaley = scale;
scalex = 1;
}
$el.find(("." + (params.progressbarfillclass))).transform(("translate3d(0,0,0) scalex(" + scalex + ") scaley(" + scaley + ")")).transition(swiper.params.speed);
}
if (params.type === 'custom' && params.rendercustom) {
$el.html(params.rendercustom(swiper, current + 1, total));
swiper.emit('paginationrender', swiper, $el[0]);
} else {
swiper.emit('paginationupdate', swiper, $el[0]);
}
},
render: function render() {
// render container
var swiper = this;
var params = swiper.params.pagination;
if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) { return; }
var slideslength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length;
var $el = swiper.pagination.$el;
var paginationhtml = '';
if (params.type === 'bullets') {
var numberofbullets = swiper.params.loop ? math.ceil((slideslength - (swiper.loopedslides * 2)) / swiper.params.slidespergroup) : swiper.snapgrid.length;
for (var i = 0; i < numberofbullets; i += 1) {
if (params.renderbullet) {
paginationhtml += params.renderbullet.call(swiper, i, params.bulletclass);
} else {
paginationhtml += "<" + (params.bulletelement) + " class=\"" + (params.bulletclass) + "\">" + (params.bulletelement) + ">";
}
}
$el.html(paginationhtml);
swiper.pagination.bullets = $el.find(("." + (params.bulletclass)));
}
if (params.type === 'fraction') {
if (params.renderfraction) {
paginationhtml = params.renderfraction.call(swiper, params.currentclass, params.totalclass);
} else {
paginationhtml =
"" +
' / ' +
"";
}
$el.html(paginationhtml);
}
if (params.type === 'progressbar') {
if (params.renderprogressbar) {
paginationhtml = params.renderprogressbar.call(swiper, params.progressbarfillclass);
} else {
paginationhtml = "";
}
$el.html(paginationhtml);
}
if (params.type !== 'custom') {
swiper.emit('paginationrender', swiper.pagination.$el[0]);
}
},
init: function init() {
var swiper = this;
var params = swiper.params.pagination;
if (!params.el) { return; }
var $el = $$1(params.el);
if ($el.length === 0) { return; }
if (
swiper.params.uniquenavelements &&
typeof params.el === 'string' &&
$el.length > 1 &&
swiper.$el.find(params.el).length === 1
) {
$el = swiper.$el.find(params.el);
}
if (params.type === 'bullets' && params.clickable) {
$el.addclass(params.clickableclass);
}
$el.addclass(params.modifierclass + params.type);
if (params.type === 'bullets' && params.dynamicbullets) {
$el.addclass(("" + (params.modifierclass) + (params.type) + "-dynamic"));
}
if (params.clickable) {
$el.on('click', ("." + (params.bulletclass)), function onclick(e) {
e.preventdefault();
var index = $$1(this).index() * swiper.params.slidespergroup;
if (swiper.params.loop) { index += swiper.loopedslides; }
swiper.slideto(index);
});
}
utils.extend(swiper.pagination, {
$el: $el,
el: $el[0],
});
},
destroy: function destroy() {
var swiper = this;
var params = swiper.params.pagination;
if (!params.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0) { return; }
var $el = swiper.pagination.$el;
$el.removeclass(params.hiddenclass);
$el.removeclass(params.modifierclass + params.type);
if (swiper.pagination.bullets) { swiper.pagination.bullets.removeclass(params.bulletactiveclass); }
if (params.clickable) {
$el.off('click', ("." + (params.bulletclass)));
}
},
};
var pagination$1 = {
name: 'pagination',
params: {
pagination: {
el: null,
bulletelement: 'span',
clickable: false,
hideonclick: false,
renderbullet: null,
renderprogressbar: null,
renderfraction: null,
rendercustom: null,
type: 'bullets', // 'bullets' or 'progressbar' or 'fraction' or 'custom'
dynamicbullets: false,
bulletclass: 'swiper-pagination-bullet',
bulletactiveclass: 'swiper-pagination-bullet-active',
modifierclass: 'swiper-pagination-', // new
currentclass: 'swiper-pagination-current',
totalclass: 'swiper-pagination-total',
hiddenclass: 'swiper-pagination-hidden',
progressbarfillclass: 'swiper-pagination-progressbar-fill',
clickableclass: 'swiper-pagination-clickable', // new
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
pagination: {
init: pagination.init.bind(swiper),
render: pagination.render.bind(swiper),
update: pagination.update.bind(swiper),
destroy: pagination.destroy.bind(swiper),
},
});
},
on: {
init: function init() {
var swiper = this;
swiper.pagination.init();
swiper.pagination.render();
swiper.pagination.update();
},
activeindexchange: function activeindexchange() {
var swiper = this;
if (swiper.params.loop) {
swiper.pagination.update();
} else if (typeof swiper.snapindex === 'undefined') {
swiper.pagination.update();
}
},
snapindexchange: function snapindexchange() {
var swiper = this;
if (!swiper.params.loop) {
swiper.pagination.update();
}
},
slideslengthchange: function slideslengthchange() {
var swiper = this;
if (swiper.params.loop) {
swiper.pagination.render();
swiper.pagination.update();
}
},
snapgridlengthchange: function snapgridlengthchange() {
var swiper = this;
if (!swiper.params.loop) {
swiper.pagination.render();
swiper.pagination.update();
}
},
destroy: function destroy() {
var swiper = this;
swiper.pagination.destroy();
},
click: function click(e) {
var swiper = this;
if (
swiper.params.pagination.el &&
swiper.params.pagination.hideonclick &&
swiper.pagination.$el.length > 0 &&
!$$1(e.target).hasclass(swiper.params.pagination.bulletclass)
) {
swiper.pagination.$el.toggleclass(swiper.params.pagination.hiddenclass);
}
},
},
};
var scrollbar = {
settranslate: function settranslate() {
var swiper = this;
if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) { return; }
var scrollbar = swiper.scrollbar;
var rtl = swiper.rtl;
var progress = swiper.progress;
var dragsize = scrollbar.dragsize;
var tracksize = scrollbar.tracksize;
var $dragel = scrollbar.$dragel;
var $el = scrollbar.$el;
var params = swiper.params.scrollbar;
var newsize = dragsize;
var newpos = (tracksize - dragsize) * progress;
if (rtl && swiper.ishorizontal()) {
newpos = -newpos;
if (newpos > 0) {
newsize = dragsize - newpos;
newpos = 0;
} else if (-newpos + dragsize > tracksize) {
newsize = tracksize + newpos;
}
} else if (newpos < 0) {
newsize = dragsize + newpos;
newpos = 0;
} else if (newpos + dragsize > tracksize) {
newsize = tracksize - newpos;
}
if (swiper.ishorizontal()) {
if (support.transforms3d) {
$dragel.transform(("translate3d(" + newpos + "px, 0, 0)"));
} else {
$dragel.transform(("translatex(" + newpos + "px)"));
}
$dragel[0].style.width = newsize + "px";
} else {
if (support.transforms3d) {
$dragel.transform(("translate3d(0px, " + newpos + "px, 0)"));
} else {
$dragel.transform(("translatey(" + newpos + "px)"));
}
$dragel[0].style.height = newsize + "px";
}
if (params.hide) {
cleartimeout(swiper.scrollbar.timeout);
$el[0].style.opacity = 1;
swiper.scrollbar.timeout = settimeout(function () {
$el[0].style.opacity = 0;
$el.transition(400);
}, 1000);
}
},
settransition: function settransition(duration) {
var swiper = this;
if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) { return; }
swiper.scrollbar.$dragel.transition(duration);
},
updatesize: function updatesize() {
var swiper = this;
if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) { return; }
var scrollbar = swiper.scrollbar;
var $dragel = scrollbar.$dragel;
var $el = scrollbar.$el;
$dragel[0].style.width = '';
$dragel[0].style.height = '';
var tracksize = swiper.ishorizontal() ? $el[0].offsetwidth : $el[0].offsetheight;
var divider = swiper.size / swiper.virtualsize;
var movedivider = divider * (tracksize / swiper.size);
var dragsize;
if (swiper.params.scrollbar.dragsize === 'auto') {
dragsize = tracksize * divider;
} else {
dragsize = parseint(swiper.params.scrollbar.dragsize, 10);
}
if (swiper.ishorizontal()) {
$dragel[0].style.width = dragsize + "px";
} else {
$dragel[0].style.height = dragsize + "px";
}
if (divider >= 1) {
$el[0].style.display = 'none';
} else {
$el[0].style.display = '';
}
if (swiper.params.scrollbarhide) {
$el[0].style.opacity = 0;
}
utils.extend(scrollbar, {
tracksize: tracksize,
divider: divider,
movedivider: movedivider,
dragsize: dragsize,
});
},
setdragposition: function setdragposition(e) {
var swiper = this;
var scrollbar = swiper.scrollbar;
var $el = scrollbar.$el;
var dragsize = scrollbar.dragsize;
var tracksize = scrollbar.tracksize;
var pointerposition;
if (swiper.ishorizontal()) {
pointerposition = ((e.type === 'touchstart' || e.type === 'touchmove') ? e.targettouches[0].pagex : e.pagex || e.clientx);
} else {
pointerposition = ((e.type === 'touchstart' || e.type === 'touchmove') ? e.targettouches[0].pagey : e.pagey || e.clienty);
}
var positionratio;
positionratio = ((pointerposition) - $el.offset()[swiper.ishorizontal() ? 'left' : 'top'] - (dragsize / 2)) / (tracksize - dragsize);
positionratio = math.max(math.min(positionratio, 1), 0);
if (swiper.rtl) {
positionratio = 1 - positionratio;
}
var position = swiper.mintranslate() + ((swiper.maxtranslate() - swiper.mintranslate()) * positionratio);
swiper.updateprogress(position);
swiper.settranslate(position);
swiper.updateactiveindex();
swiper.updateslidesclasses();
},
ondragstart: function ondragstart(e) {
var swiper = this;
var params = swiper.params.scrollbar;
var scrollbar = swiper.scrollbar;
var $wrapperel = swiper.$wrapperel;
var $el = scrollbar.$el;
var $dragel = scrollbar.$dragel;
swiper.scrollbar.istouched = true;
e.preventdefault();
e.stoppropagation();
$wrapperel.transition(100);
$dragel.transition(100);
scrollbar.setdragposition(e);
cleartimeout(swiper.scrollbar.dragtimeout);
$el.transition(0);
if (params.hide) {
$el.css('opacity', 1);
}
swiper.emit('scrollbardragstart', e);
},
ondragmove: function ondragmove(e) {
var swiper = this;
var scrollbar = swiper.scrollbar;
var $wrapperel = swiper.$wrapperel;
var $el = scrollbar.$el;
var $dragel = scrollbar.$dragel;
if (!swiper.scrollbar.istouched) { return; }
if (e.preventdefault) { e.preventdefault(); }
else { e.returnvalue = false; }
scrollbar.setdragposition(e);
$wrapperel.transition(0);
$el.transition(0);
$dragel.transition(0);
swiper.emit('scrollbardragmove', e);
},
ondragend: function ondragend(e) {
var swiper = this;
var params = swiper.params.scrollbar;
var scrollbar = swiper.scrollbar;
var $el = scrollbar.$el;
if (!swiper.scrollbar.istouched) { return; }
swiper.scrollbar.istouched = false;
if (params.hide) {
cleartimeout(swiper.scrollbar.dragtimeout);
swiper.scrollbar.dragtimeout = utils.nexttick(function () {
$el.css('opacity', 0);
$el.transition(400);
}, 1000);
}
swiper.emit('scrollbardragend', e);
if (params.snaponrelease) {
swiper.slidereset();
}
},
enabledraggable: function enabledraggable() {
var swiper = this;
if (!swiper.params.scrollbar.el) { return; }
var scrollbar = swiper.scrollbar;
var $el = scrollbar.$el;
var target = support.touch ? $el[0] : document;
$el.on(swiper.scrollbar.dragevents.start, swiper.scrollbar.ondragstart);
$$1(target).on(swiper.scrollbar.dragevents.move, swiper.scrollbar.ondragmove);
$$1(target).on(swiper.scrollbar.dragevents.end, swiper.scrollbar.ondragend);
},
disabledraggable: function disabledraggable() {
var swiper = this;
if (!swiper.params.scrollbar.el) { return; }
var scrollbar = swiper.scrollbar;
var $el = scrollbar.$el;
var target = support.touch ? $el[0] : document;
$el.off(swiper.scrollbar.dragevents.start);
$$1(target).off(swiper.scrollbar.dragevents.move);
$$1(target).off(swiper.scrollbar.dragevents.end);
},
init: function init() {
var swiper = this;
if (!swiper.params.scrollbar.el) { return; }
var scrollbar = swiper.scrollbar;
var $swiperel = swiper.$el;
var touchevents = swiper.touchevents;
var params = swiper.params.scrollbar;
var $el = $$1(params.el);
if (swiper.params.uniquenavelements && typeof params.el === 'string' && $el.length > 1 && $swiperel.find(params.el).length === 1) {
$el = $swiperel.find(params.el);
}
var $dragel = $el.find('.swiper-scrollbar-drag');
if ($dragel.length === 0) {
$dragel = $$1('');
$el.append($dragel);
}
swiper.scrollbar.dragevents = (function dragevents() {
if ((swiper.params.simulatetouch === false && !support.touch)) {
return {
start: 'mousedown',
move: 'mousemove',
end: 'mouseup',
};
}
return touchevents;
}());
utils.extend(scrollbar, {
$el: $el,
el: $el[0],
$dragel: $dragel,
dragel: $dragel[0],
});
if (params.draggable) {
scrollbar.enabledraggable();
}
},
destroy: function destroy() {
var swiper = this;
swiper.scrollbar.disabledraggable();
},
};
var scrollbar$1 = {
name: 'scrollbar',
params: {
scrollbar: {
el: null,
dragsize: 'auto',
hide: false,
draggable: false,
snaponrelease: true,
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
scrollbar: {
init: scrollbar.init.bind(swiper),
destroy: scrollbar.destroy.bind(swiper),
updatesize: scrollbar.updatesize.bind(swiper),
settranslate: scrollbar.settranslate.bind(swiper),
settransition: scrollbar.settransition.bind(swiper),
enabledraggable: scrollbar.enabledraggable.bind(swiper),
disabledraggable: scrollbar.disabledraggable.bind(swiper),
setdragposition: scrollbar.setdragposition.bind(swiper),
ondragstart: scrollbar.ondragstart.bind(swiper),
ondragmove: scrollbar.ondragmove.bind(swiper),
ondragend: scrollbar.ondragend.bind(swiper),
istouched: false,
timeout: null,
dragtimeout: null,
},
});
},
on: {
init: function init() {
var swiper = this;
swiper.scrollbar.init();
swiper.scrollbar.updatesize();
swiper.scrollbar.settranslate();
},
update: function update() {
var swiper = this;
swiper.scrollbar.updatesize();
},
resize: function resize() {
var swiper = this;
swiper.scrollbar.updatesize();
},
observerupdate: function observerupdate() {
var swiper = this;
swiper.scrollbar.updatesize();
},
settranslate: function settranslate() {
var swiper = this;
swiper.scrollbar.settranslate();
},
settransition: function settransition(duration) {
var swiper = this;
swiper.scrollbar.settransition(duration);
},
destroy: function destroy() {
var swiper = this;
swiper.scrollbar.destroy();
},
},
};
var parallax = {
settransform: function settransform(el, progress) {
var swiper = this;
var rtl = swiper.rtl;
var $el = $$1(el);
var rtlfactor = rtl ? -1 : 1;
var p = $el.attr('data-swiper-parallax') || '0';
var x = $el.attr('data-swiper-parallax-x');
var y = $el.attr('data-swiper-parallax-y');
var scale = $el.attr('data-swiper-parallax-scale');
var opacity = $el.attr('data-swiper-parallax-opacity');
if (x || y) {
x = x || '0';
y = y || '0';
} else if (swiper.ishorizontal()) {
x = p;
y = '0';
} else {
y = p;
x = '0';
}
if ((x).indexof('%') >= 0) {
x = (parseint(x, 10) * progress * rtlfactor) + "%";
} else {
x = (x * progress * rtlfactor) + "px";
}
if ((y).indexof('%') >= 0) {
y = (parseint(y, 10) * progress) + "%";
} else {
y = (y * progress) + "px";
}
if (typeof opacity !== 'undefined' && opacity !== null) {
var currentopacity = opacity - ((opacity - 1) * (1 - math.abs(progress)));
$el[0].style.opacity = currentopacity;
}
if (typeof scale === 'undefined' || scale === null) {
$el.transform(("translate3d(" + x + ", " + y + ", 0px)"));
} else {
var currentscale = scale - ((scale - 1) * (1 - math.abs(progress)));
$el.transform(("translate3d(" + x + ", " + y + ", 0px) scale(" + currentscale + ")"));
}
},
settranslate: function settranslate() {
var swiper = this;
var $el = swiper.$el;
var slides = swiper.slides;
var progress = swiper.progress;
var snapgrid = swiper.snapgrid;
$el.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]')
.each(function (index, el) {
swiper.parallax.settransform(el, progress);
});
slides.each(function (slideindex, slideel) {
var slideprogress = slideel.progress;
if (swiper.params.slidespergroup > 1 && swiper.params.slidesperview !== 'auto') {
slideprogress += math.ceil(slideindex / 2) - (progress * (snapgrid.length - 1));
}
slideprogress = math.min(math.max(slideprogress, -1), 1);
$$1(slideel).find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]')
.each(function (index, el) {
swiper.parallax.settransform(el, slideprogress);
});
});
},
settransition: function settransition(duration) {
if ( duration === void 0 ) duration = this.params.speed;
var swiper = this;
var $el = swiper.$el;
$el.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y]')
.each(function (index, parallaxel) {
var $parallaxel = $$1(parallaxel);
var parallaxduration = parseint($parallaxel.attr('data-swiper-parallax-duration'), 10) || duration;
if (duration === 0) { parallaxduration = 0; }
$parallaxel.transition(parallaxduration);
});
},
};
var parallax$1 = {
name: 'parallax',
params: {
parallax: {
enabled: false,
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
parallax: {
settransform: parallax.settransform.bind(swiper),
settranslate: parallax.settranslate.bind(swiper),
settransition: parallax.settransition.bind(swiper),
},
});
},
on: {
beforeinit: function beforeinit() {
var swiper = this;
swiper.params.watchslidesprogress = true;
},
init: function init() {
var swiper = this;
if (!swiper.params.parallax) { return; }
swiper.parallax.settranslate();
},
settranslate: function settranslate() {
var swiper = this;
if (!swiper.params.parallax) { return; }
swiper.parallax.settranslate();
},
settransition: function settransition(duration) {
var swiper = this;
if (!swiper.params.parallax) { return; }
swiper.parallax.settransition(duration);
},
},
};
var zoom = {
// calc scale from multi-touches
getdistancebetweentouches: function getdistancebetweentouches(e) {
if (e.targettouches.length < 2) { return 1; }
var x1 = e.targettouches[0].pagex;
var y1 = e.targettouches[0].pagey;
var x2 = e.targettouches[1].pagex;
var y2 = e.targettouches[1].pagey;
var distance = math.sqrt((math.pow( (x2 - x1), 2 )) + (math.pow( (y2 - y1), 2 )));
return distance;
},
// events
ongesturestart: function ongesturestart(e) {
var swiper = this;
var params = swiper.params.zoom;
var zoom = swiper.zoom;
var gesture = zoom.gesture;
zoom.fakegesturetouched = false;
zoom.fakegesturemoved = false;
if (!support.gestures) {
if (e.type !== 'touchstart' || (e.type === 'touchstart' && e.targettouches.length < 2)) {
return;
}
zoom.fakegesturetouched = true;
gesture.scalestart = zoom.getdistancebetweentouches(e);
}
if (!gesture.$slideel || !gesture.$slideel.length) {
gesture.$slideel = $$1(this);
if (gesture.$slideel.length === 0) { gesture.$slideel = swiper.slides.eq(swiper.activeindex); }
gesture.$imageel = gesture.$slideel.find('img, svg, canvas');
gesture.$imagewrapel = gesture.$imageel.parent(("." + (params.containerclass)));
gesture.maxratio = gesture.$imagewrapel.attr('data-swiper-zoom') || params.maxratio;
if (gesture.$imagewrapel.length === 0) {
gesture.$imageel = undefined;
return;
}
}
gesture.$imageel.transition(0);
swiper.zoom.isscaling = true;
},
ongesturechange: function ongesturechange(e) {
var swiper = this;
var params = swiper.params.zoom;
var zoom = swiper.zoom;
var gesture = zoom.gesture;
if (!support.gestures) {
if (e.type !== 'touchmove' || (e.type === 'touchmove' && e.targettouches.length < 2)) {
return;
}
zoom.fakegesturemoved = true;
gesture.scalemove = zoom.getdistancebetweentouches(e);
}
if (!gesture.$imageel || gesture.$imageel.length === 0) { return; }
if (support.gestures) {
swiper.zoom.scale = e.scale * zoom.currentscale;
} else {
zoom.scale = (gesture.scalemove / gesture.scalestart) * zoom.currentscale;
}
if (zoom.scale > gesture.maxratio) {
zoom.scale = (gesture.maxratio - 1) + (math.pow( ((zoom.scale - gesture.maxratio) + 1), 0.5 ));
}
if (zoom.scale < params.minratio) {
zoom.scale = (params.minratio + 1) - (math.pow( ((params.minratio - zoom.scale) + 1), 0.5 ));
}
gesture.$imageel.transform(("translate3d(0,0,0) scale(" + (zoom.scale) + ")"));
},
ongestureend: function ongestureend(e) {
var swiper = this;
var params = swiper.params.zoom;
var zoom = swiper.zoom;
var gesture = zoom.gesture;
if (!support.gestures) {
if (!zoom.fakegesturetouched || !zoom.fakegesturemoved) {
return;
}
if (e.type !== 'touchend' || (e.type === 'touchend' && e.changedtouches.length < 2 && !device.android)) {
return;
}
zoom.fakegesturetouched = false;
zoom.fakegesturemoved = false;
}
if (!gesture.$imageel || gesture.$imageel.length === 0) { return; }
zoom.scale = math.max(math.min(zoom.scale, gesture.maxratio), params.minratio);
gesture.$imageel.transition(swiper.params.speed).transform(("translate3d(0,0,0) scale(" + (zoom.scale) + ")"));
zoom.currentscale = zoom.scale;
zoom.isscaling = false;
if (zoom.scale === 1) { gesture.$slideel = undefined; }
},
ontouchstart: function ontouchstart(e) {
var swiper = this;
var zoom = swiper.zoom;
var gesture = zoom.gesture;
var image = zoom.image;
if (!gesture.$imageel || gesture.$imageel.length === 0) { return; }
if (image.istouched) { return; }
if (device.android) { e.preventdefault(); }
image.istouched = true;
image.touchesstart.x = e.type === 'touchstart' ? e.targettouches[0].pagex : e.pagex;
image.touchesstart.y = e.type === 'touchstart' ? e.targettouches[0].pagey : e.pagey;
},
ontouchmove: function ontouchmove(e) {
var swiper = this;
var zoom = swiper.zoom;
var gesture = zoom.gesture;
var image = zoom.image;
var velocity = zoom.velocity;
if (!gesture.$imageel || gesture.$imageel.length === 0) { return; }
swiper.allowclick = false;
if (!image.istouched || !gesture.$slideel) { return; }
if (!image.ismoved) {
image.width = gesture.$imageel[0].offsetwidth;
image.height = gesture.$imageel[0].offsetheight;
image.startx = utils.gettranslate(gesture.$imagewrapel[0], 'x') || 0;
image.starty = utils.gettranslate(gesture.$imagewrapel[0], 'y') || 0;
gesture.slidewidth = gesture.$slideel[0].offsetwidth;
gesture.slideheight = gesture.$slideel[0].offsetheight;
gesture.$imagewrapel.transition(0);
if (swiper.rtl) { image.startx = -image.startx; }
if (swiper.rtl) { image.starty = -image.starty; }
}
// define if we need image drag
var scaledwidth = image.width * zoom.scale;
var scaledheight = image.height * zoom.scale;
if (scaledwidth < gesture.slidewidth && scaledheight < gesture.slideheight) { return; }
image.minx = math.min(((gesture.slidewidth / 2) - (scaledwidth / 2)), 0);
image.maxx = -image.minx;
image.miny = math.min(((gesture.slideheight / 2) - (scaledheight / 2)), 0);
image.maxy = -image.miny;
image.touchescurrent.x = e.type === 'touchmove' ? e.targettouches[0].pagex : e.pagex;
image.touchescurrent.y = e.type === 'touchmove' ? e.targettouches[0].pagey : e.pagey;
if (!image.ismoved && !zoom.isscaling) {
if (
swiper.ishorizontal() &&
(
(math.floor(image.minx) === math.floor(image.startx) && image.touchescurrent.x < image.touchesstart.x) ||
(math.floor(image.maxx) === math.floor(image.startx) && image.touchescurrent.x > image.touchesstart.x)
)
) {
image.istouched = false;
return;
} else if (
!swiper.ishorizontal() &&
(
(math.floor(image.miny) === math.floor(image.starty) && image.touchescurrent.y < image.touchesstart.y) ||
(math.floor(image.maxy) === math.floor(image.starty) && image.touchescurrent.y > image.touchesstart.y)
)
) {
image.istouched = false;
return;
}
}
e.preventdefault();
e.stoppropagation();
image.ismoved = true;
image.currentx = (image.touchescurrent.x - image.touchesstart.x) + image.startx;
image.currenty = (image.touchescurrent.y - image.touchesstart.y) + image.starty;
if (image.currentx < image.minx) {
image.currentx = (image.minx + 1) - (math.pow( ((image.minx - image.currentx) + 1), 0.8 ));
}
if (image.currentx > image.maxx) {
image.currentx = (image.maxx - 1) + (math.pow( ((image.currentx - image.maxx) + 1), 0.8 ));
}
if (image.currenty < image.miny) {
image.currenty = (image.miny + 1) - (math.pow( ((image.miny - image.currenty) + 1), 0.8 ));
}
if (image.currenty > image.maxy) {
image.currenty = (image.maxy - 1) + (math.pow( ((image.currenty - image.maxy) + 1), 0.8 ));
}
// velocity
if (!velocity.prevpositionx) { velocity.prevpositionx = image.touchescurrent.x; }
if (!velocity.prevpositiony) { velocity.prevpositiony = image.touchescurrent.y; }
if (!velocity.prevtime) { velocity.prevtime = date.now(); }
velocity.x = (image.touchescurrent.x - velocity.prevpositionx) / (date.now() - velocity.prevtime) / 2;
velocity.y = (image.touchescurrent.y - velocity.prevpositiony) / (date.now() - velocity.prevtime) / 2;
if (math.abs(image.touchescurrent.x - velocity.prevpositionx) < 2) { velocity.x = 0; }
if (math.abs(image.touchescurrent.y - velocity.prevpositiony) < 2) { velocity.y = 0; }
velocity.prevpositionx = image.touchescurrent.x;
velocity.prevpositiony = image.touchescurrent.y;
velocity.prevtime = date.now();
gesture.$imagewrapel.transform(("translate3d(" + (image.currentx) + "px, " + (image.currenty) + "px,0)"));
},
ontouchend: function ontouchend() {
var swiper = this;
var zoom = swiper.zoom;
var gesture = zoom.gesture;
var image = zoom.image;
var velocity = zoom.velocity;
if (!gesture.$imageel || gesture.$imageel.length === 0) { return; }
if (!image.istouched || !image.ismoved) {
image.istouched = false;
image.ismoved = false;
return;
}
image.istouched = false;
image.ismoved = false;
var momentumdurationx = 300;
var momentumdurationy = 300;
var momentumdistancex = velocity.x * momentumdurationx;
var newpositionx = image.currentx + momentumdistancex;
var momentumdistancey = velocity.y * momentumdurationy;
var newpositiony = image.currenty + momentumdistancey;
// fix duration
if (velocity.x !== 0) { momentumdurationx = math.abs((newpositionx - image.currentx) / velocity.x); }
if (velocity.y !== 0) { momentumdurationy = math.abs((newpositiony - image.currenty) / velocity.y); }
var momentumduration = math.max(momentumdurationx, momentumdurationy);
image.currentx = newpositionx;
image.currenty = newpositiony;
// define if we need image drag
var scaledwidth = image.width * zoom.scale;
var scaledheight = image.height * zoom.scale;
image.minx = math.min(((gesture.slidewidth / 2) - (scaledwidth / 2)), 0);
image.maxx = -image.minx;
image.miny = math.min(((gesture.slideheight / 2) - (scaledheight / 2)), 0);
image.maxy = -image.miny;
image.currentx = math.max(math.min(image.currentx, image.maxx), image.minx);
image.currenty = math.max(math.min(image.currenty, image.maxy), image.miny);
gesture.$imagewrapel.transition(momentumduration).transform(("translate3d(" + (image.currentx) + "px, " + (image.currenty) + "px,0)"));
},
ontransitionend: function ontransitionend() {
var swiper = this;
var zoom = swiper.zoom;
var gesture = zoom.gesture;
if (gesture.$slideel && swiper.previousindex !== swiper.activeindex) {
gesture.$imageel.transform('translate3d(0,0,0) scale(1)');
gesture.$imagewrapel.transform('translate3d(0,0,0)');
gesture.$slideel = undefined;
gesture.$imageel = undefined;
gesture.$imagewrapel = undefined;
zoom.scale = 1;
zoom.currentscale = 1;
}
},
// toggle zoom
toggle: function toggle(e) {
var swiper = this;
var zoom = swiper.zoom;
if (zoom.scale && zoom.scale !== 1) {
// zoom out
zoom.out();
} else {
// zoom in
zoom.in(e);
}
},
in: function in$1(e) {
var swiper = this;
var zoom = swiper.zoom;
var params = swiper.params.zoom;
var gesture = zoom.gesture;
var image = zoom.image;
if (!gesture.$slideel) {
gesture.$slideel = swiper.clickedslide ? $$1(swiper.clickedslide) : swiper.slides.eq(swiper.activeindex);
gesture.$imageel = gesture.$slideel.find('img, svg, canvas');
gesture.$imagewrapel = gesture.$imageel.parent(("." + (params.containerclass)));
}
if (!gesture.$imageel || gesture.$imageel.length === 0) { return; }
gesture.$slideel.addclass(("" + (params.zoomedslideclass)));
var touchx;
var touchy;
var offsetx;
var offsety;
var diffx;
var diffy;
var translatex;
var translatey;
var imagewidth;
var imageheight;
var scaledwidth;
var scaledheight;
var translateminx;
var translateminy;
var translatemaxx;
var translatemaxy;
var slidewidth;
var slideheight;
if (typeof image.touchesstart.x === 'undefined' && e) {
touchx = e.type === 'touchend' ? e.changedtouches[0].pagex : e.pagex;
touchy = e.type === 'touchend' ? e.changedtouches[0].pagey : e.pagey;
} else {
touchx = image.touchesstart.x;
touchy = image.touchesstart.y;
}
zoom.scale = gesture.$imagewrapel.attr('data-swiper-zoom') || params.maxratio;
zoom.currentscale = gesture.$imagewrapel.attr('data-swiper-zoom') || params.maxratio;
if (e) {
slidewidth = gesture.$slideel[0].offsetwidth;
slideheight = gesture.$slideel[0].offsetheight;
offsetx = gesture.$slideel.offset().left;
offsety = gesture.$slideel.offset().top;
diffx = (offsetx + (slidewidth / 2)) - touchx;
diffy = (offsety + (slideheight / 2)) - touchy;
imagewidth = gesture.$imageel[0].offsetwidth;
imageheight = gesture.$imageel[0].offsetheight;
scaledwidth = imagewidth * zoom.scale;
scaledheight = imageheight * zoom.scale;
translateminx = math.min(((slidewidth / 2) - (scaledwidth / 2)), 0);
translateminy = math.min(((slideheight / 2) - (scaledheight / 2)), 0);
translatemaxx = -translateminx;
translatemaxy = -translateminy;
translatex = diffx * zoom.scale;
translatey = diffy * zoom.scale;
if (translatex < translateminx) {
translatex = translateminx;
}
if (translatex > translatemaxx) {
translatex = translatemaxx;
}
if (translatey < translateminy) {
translatey = translateminy;
}
if (translatey > translatemaxy) {
translatey = translatemaxy;
}
} else {
translatex = 0;
translatey = 0;
}
gesture.$imagewrapel.transition(300).transform(("translate3d(" + translatex + "px, " + translatey + "px,0)"));
gesture.$imageel.transition(300).transform(("translate3d(0,0,0) scale(" + (zoom.scale) + ")"));
},
out: function out() {
var swiper = this;
var zoom = swiper.zoom;
var params = swiper.params.zoom;
var gesture = zoom.gesture;
if (!gesture.$slideel) {
gesture.$slideel = swiper.clickedslide ? $$1(swiper.clickedslide) : swiper.slides.eq(swiper.activeindex);
gesture.$imageel = gesture.$slideel.find('img, svg, canvas');
gesture.$imagewrapel = gesture.$imageel.parent(("." + (params.containerclass)));
}
if (!gesture.$imageel || gesture.$imageel.length === 0) { return; }
zoom.scale = 1;
zoom.currentscale = 1;
gesture.$imagewrapel.transition(300).transform('translate3d(0,0,0)');
gesture.$imageel.transition(300).transform('translate3d(0,0,0) scale(1)');
gesture.$slideel.removeclass(("" + (params.zoomedslideclass)));
gesture.$slideel = undefined;
},
// attach/detach events
enable: function enable() {
var swiper = this;
var zoom = swiper.zoom;
if (zoom.enabled) { return; }
zoom.enabled = true;
var slides = swiper.slides;
var passivelistener = swiper.touchevents.start === 'touchstart' && support.passivelistener && swiper.params.passivelisteners ? { passive: true, capture: false } : false;
// scale image
if (support.gestures) {
slides.on('gesturestart', zoom.ongesturestart, passivelistener);
slides.on('gesturechange', zoom.ongesturechange, passivelistener);
slides.on('gestureend', zoom.ongestureend, passivelistener);
} else if (swiper.touchevents.start === 'touchstart') {
slides.on(swiper.touchevents.start, zoom.ongesturestart, passivelistener);
slides.on(swiper.touchevents.move, zoom.ongesturechange, passivelistener);
slides.on(swiper.touchevents.end, zoom.ongestureend, passivelistener);
}
// move image
swiper.slides.each(function (index, slideel) {
var $slideel = $$1(slideel);
if ($slideel.find(("." + (swiper.params.zoom.containerclass))).length > 0) {
$slideel.on(swiper.touchevents.move, zoom.ontouchmove);
}
});
},
disable: function disable() {
var swiper = this;
var zoom = swiper.zoom;
if (!zoom.enabled) { return; }
swiper.zoom.enabled = false;
var slides = swiper.slides;
var passivelistener = swiper.touchevents.start === 'touchstart' && support.passivelistener && swiper.params.passivelisteners ? { passive: true, capture: false } : false;
// scale image
if (support.gestures) {
slides.off('gesturestart', zoom.ongesturestart, passivelistener);
slides.off('gesturechange', zoom.ongesturechange, passivelistener);
slides.off('gestureend', zoom.ongestureend, passivelistener);
} else if (swiper.touchevents.start === 'touchstart') {
slides.off(swiper.touchevents.start, zoom.ongesturestart, passivelistener);
slides.off(swiper.touchevents.move, zoom.ongesturechange, passivelistener);
slides.off(swiper.touchevents.end, zoom.ongestureend, passivelistener);
}
// move image
swiper.slides.each(function (index, slideel) {
var $slideel = $$1(slideel);
if ($slideel.find(("." + (swiper.params.zoom.containerclass))).length > 0) {
$slideel.off(swiper.touchevents.move, zoom.ontouchmove);
}
});
},
};
var zoom$1 = {
name: 'zoom',
params: {
zoom: {
enabled: false,
maxratio: 3,
minratio: 1,
toggle: true,
containerclass: 'swiper-zoom-container',
zoomedslideclass: 'swiper-slide-zoomed',
},
},
create: function create() {
var swiper = this;
var zoom = {
enabled: false,
scale: 1,
currentscale: 1,
isscaling: false,
gesture: {
$slideel: undefined,
slidewidth: undefined,
slideheight: undefined,
$imageel: undefined,
$imagewrapel: undefined,
maxratio: 3,
},
image: {
istouched: undefined,
ismoved: undefined,
currentx: undefined,
currenty: undefined,
minx: undefined,
miny: undefined,
maxx: undefined,
maxy: undefined,
width: undefined,
height: undefined,
startx: undefined,
starty: undefined,
touchesstart: {},
touchescurrent: {},
},
velocity: {
x: undefined,
y: undefined,
prevpositionx: undefined,
prevpositiony: undefined,
prevtime: undefined,
},
};
('ongesturestart ongesturechange ongestureend ontouchstart ontouchmove ontouchend ontransitionend toggle enable disable in out').split(' ').foreach(function (methodname) {
zoom[methodname] = zoom[methodname].bind(swiper);
});
utils.extend(swiper, {
zoom: zoom,
});
},
on: {
init: function init() {
var swiper = this;
if (swiper.params.zoom.enabled) {
swiper.zoom.enable();
}
},
destroy: function destroy() {
var swiper = this;
swiper.zoom.disable();
},
touchstart: function touchstart(e) {
var swiper = this;
if (!swiper.zoom.enabled) { return; }
swiper.zoom.ontouchstart(e);
},
touchend: function touchend(e) {
var swiper = this;
if (!swiper.zoom.enabled) { return; }
swiper.zoom.ontouchend(e);
},
doubletap: function doubletap(e) {
var swiper = this;
if (swiper.params.zoom.enabled && swiper.zoom.enabled && swiper.params.zoom.toggle) {
swiper.zoom.toggle(e);
}
},
transitionend: function transitionend() {
var swiper = this;
if (swiper.zoom.enabled && swiper.params.zoom.enabled) {
swiper.zoom.ontransitionend();
}
},
},
};
var lazy = {
loadinslide: function loadinslide(index, loadinduplicate) {
if ( loadinduplicate === void 0 ) loadinduplicate = true;
var swiper = this;
var params = swiper.params.lazy;
if (typeof index === 'undefined') { return; }
if (swiper.slides.length === 0) { return; }
var isvirtual = swiper.virtual && swiper.params.virtual.enabled;
var $slideel = isvirtual
? swiper.$wrapperel.children(("." + (swiper.params.slideclass) + "[data-swiper-slide-index=\"" + index + "\"]"))
: swiper.slides.eq(index);
var $images = $slideel.find(("." + (params.elementclass) + ":not(." + (params.loadedclass) + "):not(." + (params.loadingclass) + ")"));
if ($slideel.hasclass(params.elementclass) && !$slideel.hasclass(params.loadedclass) && !$slideel.hasclass(params.loadingclass)) {
$images = $images.add($slideel[0]);
}
if ($images.length === 0) { return; }
$images.each(function (imageindex, imageel) {
var $imageel = $$1(imageel);
$imageel.addclass(params.loadingclass);
var background = $imageel.attr('data-background');
var src = $imageel.attr('data-src');
var srcset = $imageel.attr('data-srcset');
var sizes = $imageel.attr('data-sizes');
swiper.loadimage($imageel[0], (src || background), srcset, sizes, false, function () {
if (typeof swiper === 'undefined' || swiper === null || !swiper || (swiper && !swiper.params) || swiper.destroyed) { return; }
if (background) {
$imageel.css('background-image', ("url(\"" + background + "\")"));
$imageel.removeattr('data-background');
} else {
if (srcset) {
$imageel.attr('srcset', srcset);
$imageel.removeattr('data-srcset');
}
if (sizes) {
$imageel.attr('sizes', sizes);
$imageel.removeattr('data-sizes');
}
if (src) {
$imageel.attr('src', src);
$imageel.removeattr('data-src');
}
}
$imageel.addclass(params.loadedclass).removeclass(params.loadingclass);
$slideel.find(("." + (params.preloaderclass))).remove();
if (swiper.params.loop && loadinduplicate) {
var slideoriginalindex = $slideel.attr('data-swiper-slide-index');
if ($slideel.hasclass(swiper.params.slideduplicateclass)) {
var originalslide = swiper.$wrapperel.children(("[data-swiper-slide-index=\"" + slideoriginalindex + "\"]:not(." + (swiper.params.slideduplicateclass) + ")"));
swiper.lazy.loadinslide(originalslide.index(), false);
} else {
var duplicatedslide = swiper.$wrapperel.children(("." + (swiper.params.slideduplicateclass) + "[data-swiper-slide-index=\"" + slideoriginalindex + "\"]"));
swiper.lazy.loadinslide(duplicatedslide.index(), false);
}
}
swiper.emit('lazyimageready', $slideel[0], $imageel[0]);
});
swiper.emit('lazyimageload', $slideel[0], $imageel[0]);
});
},
load: function load() {
var swiper = this;
var $wrapperel = swiper.$wrapperel;
var swiperparams = swiper.params;
var slides = swiper.slides;
var activeindex = swiper.activeindex;
var isvirtual = swiper.virtual && swiperparams.virtual.enabled;
var params = swiperparams.lazy;
var slidesperview = swiperparams.slidesperview;
if (slidesperview === 'auto') {
slidesperview = 0;
}
function slideexist(index) {
if (isvirtual) {
if ($wrapperel.children(("." + (swiperparams.slideclass) + "[data-swiper-slide-index=\"" + index + "\"]")).length) {
return true;
}
} else if (slides[index]) { return true; }
return false;
}
function slideindex(slideel) {
if (isvirtual) {
return $$1(slideel).attr('data-swiper-slide-index');
}
return $$1(slideel).index();
}
if (!swiper.lazy.initialimageloaded) { swiper.lazy.initialimageloaded = true; }
if (swiper.params.watchslidesvisibility) {
$wrapperel.children(("." + (swiperparams.slidevisibleclass))).each(function (elindex, slideel) {
var index = isvirtual ? $$1(slideel).attr('data-swiper-slide-index') : $$1(slideel).index();
swiper.lazy.loadinslide(index);
});
} else if (slidesperview > 1) {
for (var i = activeindex; i < activeindex + slidesperview; i += 1) {
if (slideexist(i)) { swiper.lazy.loadinslide(i); }
}
} else {
swiper.lazy.loadinslide(activeindex);
}
if (params.loadprevnext) {
if (slidesperview > 1 || (params.loadprevnextamount && params.loadprevnextamount > 1)) {
var amount = params.loadprevnextamount;
var spv = slidesperview;
var maxindex = math.min(activeindex + spv + math.max(amount, spv), slides.length);
var minindex = math.max(activeindex - math.max(spv, amount), 0);
// next slides
for (var i$1 = activeindex + slidesperview; i$1 < maxindex; i$1 += 1) {
if (slideexist(i$1)) { swiper.lazy.loadinslide(i$1); }
}
// prev slides
for (var i$2 = minindex; i$2 < activeindex; i$2 += 1) {
if (slideexist(i$2)) { swiper.lazy.loadinslide(i$2); }
}
} else {
var nextslide = $wrapperel.children(("." + (swiperparams.slidenextclass)));
if (nextslide.length > 0) { swiper.lazy.loadinslide(slideindex(nextslide)); }
var prevslide = $wrapperel.children(("." + (swiperparams.slideprevclass)));
if (prevslide.length > 0) { swiper.lazy.loadinslide(slideindex(prevslide)); }
}
}
},
};
var lazy$1 = {
name: 'lazy',
params: {
lazy: {
enabled: false,
loadprevnext: false,
loadprevnextamount: 1,
loadontransitionstart: false,
elementclass: 'swiper-lazy',
loadingclass: 'swiper-lazy-loading',
loadedclass: 'swiper-lazy-loaded',
preloaderclass: 'swiper-lazy-preloader',
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
lazy: {
initialimageloaded: false,
load: lazy.load.bind(swiper),
loadinslide: lazy.loadinslide.bind(swiper),
},
});
},
on: {
beforeinit: function beforeinit() {
var swiper = this;
if (swiper.params.lazy.enabled && swiper.params.preloadimages) {
swiper.params.preloadimages = false;
}
},
init: function init() {
var swiper = this;
if (swiper.params.lazy.enabled && !swiper.params.loop && swiper.params.initialslide === 0) {
swiper.lazy.load();
}
},
scroll: function scroll() {
var swiper = this;
if (swiper.params.freemode && !swiper.params.freemodesticky) {
swiper.lazy.load();
}
},
resize: function resize() {
var swiper = this;
if (swiper.params.lazy.enabled) {
swiper.lazy.load();
}
},
scrollbardragmove: function scrollbardragmove() {
var swiper = this;
if (swiper.params.lazy.enabled) {
swiper.lazy.load();
}
},
transitionstart: function transitionstart() {
var swiper = this;
if (swiper.params.lazy.enabled) {
if (swiper.params.lazy.loadontransitionstart || (!swiper.params.lazy.loadontransitionstart && !swiper.lazy.initialimageloaded)) {
swiper.lazy.load();
}
}
},
transitionend: function transitionend() {
var swiper = this;
if (swiper.params.lazy.enabled && !swiper.params.lazy.loadontransitionstart) {
swiper.lazy.load();
}
},
},
};
/* eslint no-bitwise: ["error", { "allow": [">>"] }] */
var controller = {
linearspline: function linearspline(x, y) {
var binarysearch = (function search() {
var maxindex;
var minindex;
var guess;
return function (array, val) {
minindex = -1;
maxindex = array.length;
while (maxindex - minindex > 1) {
guess = maxindex + minindex >> 1;
if (array[guess] <= val) {
minindex = guess;
} else {
maxindex = guess;
}
}
return maxindex;
};
}());
this.x = x;
this.y = y;
this.lastindex = x.length - 1;
// given an x value (x2), return the expected y2 value:
// (x1,y1) is the known point before given value,
// (x3,y3) is the known point after given value.
var i1;
var i3;
this.interpolate = function interpolate(x2) {
if (!x2) { return 0; }
// get the indexes of x1 and x3 (the array indexes before and after given x2):
i3 = binarysearch(this.x, x2);
i1 = i3 - 1;
// we have our indexes i1 & i3, so we can calculate already:
// y2 := ((x2−x1) × (y3−y1)) ÷ (x3−x1) + y1
return (((x2 - this.x[i1]) * (this.y[i3] - this.y[i1])) / (this.x[i3] - this.x[i1])) + this.y[i1];
};
return this;
},
// xxx: for now i will just save one spline function to to
getinterpolatefunction: function getinterpolatefunction(c) {
var swiper = this;
if (!swiper.controller.spline) {
swiper.controller.spline = swiper.params.loop ?
new controller.linearspline(swiper.slidesgrid, c.slidesgrid) :
new controller.linearspline(swiper.snapgrid, c.snapgrid);
}
},
settranslate: function settranslate(settranslate$1, bycontroller) {
var swiper = this;
var controlled = swiper.controller.control;
var multiplier;
var controlledtranslate;
function setcontrolledtranslate(c) {
// this will create an interpolate function based on the snapgrids
// x is the grid of the scrolled scroller and y will be the controlled scroller
// it makes sense to create this only once and recall it for the interpolation
// the function does a lot of value caching for performance
var translate = c.rtl && c.params.direction === 'horizontal' ? -swiper.translate : swiper.translate;
if (swiper.params.controller.by === 'slide') {
swiper.controller.getinterpolatefunction(c);
// i am not sure why the values have to be multiplicated this way, tried to invert the snapgrid
// but it did not work out
controlledtranslate = -swiper.controller.spline.interpolate(-translate);
}
if (!controlledtranslate || swiper.params.controller.by === 'container') {
multiplier = (c.maxtranslate() - c.mintranslate()) / (swiper.maxtranslate() - swiper.mintranslate());
controlledtranslate = ((translate - swiper.mintranslate()) * multiplier) + c.mintranslate();
}
if (swiper.params.controller.inverse) {
controlledtranslate = c.maxtranslate() - controlledtranslate;
}
c.updateprogress(controlledtranslate);
c.settranslate(controlledtranslate, swiper);
c.updateactiveindex();
c.updateslidesclasses();
}
if (array.isarray(controlled)) {
for (var i = 0; i < controlled.length; i += 1) {
if (controlled[i] !== bycontroller && controlled[i] instanceof swiper$1) {
setcontrolledtranslate(controlled[i]);
}
}
} else if (controlled instanceof swiper$1 && bycontroller !== controlled) {
setcontrolledtranslate(controlled);
}
},
settransition: function settransition(duration, bycontroller) {
var swiper = this;
var controlled = swiper.controller.control;
var i;
function setcontrolledtransition(c) {
c.settransition(duration, swiper);
if (duration !== 0) {
c.transitionstart();
c.$wrapperel.transitionend(function () {
if (!controlled) { return; }
if (c.params.loop && swiper.params.controller.by === 'slide') {
c.loopfix();
}
c.transitionend();
});
}
}
if (array.isarray(controlled)) {
for (i = 0; i < controlled.length; i += 1) {
if (controlled[i] !== bycontroller && controlled[i] instanceof swiper$1) {
setcontrolledtransition(controlled[i]);
}
}
} else if (controlled instanceof swiper$1 && bycontroller !== controlled) {
setcontrolledtransition(controlled);
}
},
};
var controller$1 = {
name: 'controller',
params: {
controller: {
control: undefined,
inverse: false,
by: 'slide', // or 'container'
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
controller: {
control: swiper.params.controller.control,
getinterpolatefunction: controller.getinterpolatefunction.bind(swiper),
settranslate: controller.settranslate.bind(swiper),
settransition: controller.settransition.bind(swiper),
},
});
},
on: {
update: function update() {
var swiper = this;
if (!swiper.controller.control) { return; }
if (swiper.controller.spline) {
swiper.controller.spline = undefined;
delete swiper.controller.spline;
}
},
resize: function resize() {
var swiper = this;
if (!swiper.controller.control) { return; }
if (swiper.controller.spline) {
swiper.controller.spline = undefined;
delete swiper.controller.spline;
}
},
observerupdate: function observerupdate() {
var swiper = this;
if (!swiper.controller.control) { return; }
if (swiper.controller.spline) {
swiper.controller.spline = undefined;
delete swiper.controller.spline;
}
},
settranslate: function settranslate(translate, bycontroller) {
var swiper = this;
if (!swiper.controller.control) { return; }
swiper.controller.settranslate(translate, bycontroller);
},
settransition: function settransition(duration, bycontroller) {
var swiper = this;
if (!swiper.controller.control) { return; }
swiper.controller.settransition(duration, bycontroller);
},
},
};
var a11y = {
makeelfocusable: function makeelfocusable($el) {
$el.attr('tabindex', '0');
return $el;
},
addelrole: function addelrole($el, role) {
$el.attr('role', role);
return $el;
},
addellabel: function addellabel($el, label) {
$el.attr('aria-label', label);
return $el;
},
disableel: function disableel($el) {
$el.attr('aria-disabled', true);
return $el;
},
enableel: function enableel($el) {
$el.attr('aria-disabled', false);
return $el;
},
onenterkey: function onenterkey(e) {
var swiper = this;
var params = swiper.params.a11y;
if (e.keycode !== 13) { return; }
var $targetel = $$1(e.target);
if (swiper.navigation && swiper.navigation.$nextel && $targetel.is(swiper.navigation.$nextel)) {
if (!(swiper.isend && !swiper.params.loop)) {
swiper.slidenext();
}
if (swiper.isend) {
swiper.a11y.notify(params.lastslidemessage);
} else {
swiper.a11y.notify(params.nextslidemessage);
}
}
if (swiper.navigation && swiper.navigation.$prevel && $targetel.is(swiper.navigation.$prevel)) {
if (!(swiper.isbeginning && !swiper.params.loop)) {
swiper.slideprev();
}
if (swiper.isbeginning) {
swiper.a11y.notify(params.firstslidemessage);
} else {
swiper.a11y.notify(params.prevslidemessage);
}
}
if (swiper.pagination && $targetel.is(("." + (swiper.params.pagination.bulletclass)))) {
$targetel[0].click();
}
},
notify: function notify(message) {
var swiper = this;
var notification = swiper.a11y.liveregion;
if (notification.length === 0) { return; }
notification.html('');
notification.html(message);
},
updatenavigation: function updatenavigation() {
var swiper = this;
if (swiper.params.loop) { return; }
var ref = swiper.navigation;
var $nextel = ref.$nextel;
var $prevel = ref.$prevel;
if ($prevel && $prevel.length > 0) {
if (swiper.isbeginning) {
swiper.a11y.disableel($prevel);
} else {
swiper.a11y.enableel($prevel);
}
}
if ($nextel && $nextel.length > 0) {
if (swiper.isend) {
swiper.a11y.disableel($nextel);
} else {
swiper.a11y.enableel($nextel);
}
}
},
updatepagination: function updatepagination() {
var swiper = this;
var params = swiper.params.a11y;
if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) {
swiper.pagination.bullets.each(function (bulletindex, bulletel) {
var $bulletel = $$1(bulletel);
swiper.a11y.makeelfocusable($bulletel);
swiper.a11y.addelrole($bulletel, 'button');
swiper.a11y.addellabel($bulletel, params.paginationbulletmessage.replace(/{{index}}/, $bulletel.index() + 1));
});
}
},
init: function init() {
var swiper = this;
swiper.$el.append(swiper.a11y.liveregion);
// navigation
var params = swiper.params.a11y;
var $nextel;
var $prevel;
if (swiper.navigation && swiper.navigation.$nextel) {
$nextel = swiper.navigation.$nextel;
}
if (swiper.navigation && swiper.navigation.$prevel) {
$prevel = swiper.navigation.$prevel;
}
if ($nextel) {
swiper.a11y.makeelfocusable($nextel);
swiper.a11y.addelrole($nextel, 'button');
swiper.a11y.addellabel($nextel, params.nextslidemessage);
$nextel.on('keydown', swiper.a11y.onenterkey);
}
if ($prevel) {
swiper.a11y.makeelfocusable($prevel);
swiper.a11y.addelrole($prevel, 'button');
swiper.a11y.addellabel($prevel, params.prevslidemessage);
$prevel.on('keydown', swiper.a11y.onenterkey);
}
// pagination
if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) {
swiper.pagination.$el.on('keydown', ("." + (swiper.params.pagination.bulletclass)), swiper.a11y.onenterkey);
}
},
destroy: function destroy() {
var swiper = this;
if (swiper.a11y.liveregion && swiper.a11y.liveregion.length > 0) { swiper.a11y.liveregion.remove(); }
var $nextel;
var $prevel;
if (swiper.navigation && swiper.navigation.$nextel) {
$nextel = swiper.navigation.$nextel;
}
if (swiper.navigation && swiper.navigation.$prevel) {
$prevel = swiper.navigation.$prevel;
}
if ($nextel) {
$nextel.off('keydown', swiper.a11y.onenterkey);
}
if ($prevel) {
$prevel.off('keydown', swiper.a11y.onenterkey);
}
// pagination
if (swiper.pagination && swiper.params.pagination.clickable && swiper.pagination.bullets && swiper.pagination.bullets.length) {
swiper.pagination.$el.off('keydown', ("." + (swiper.params.pagination.bulletclass)), swiper.a11y.onenterkey);
}
},
};
var a11y = {
name: 'a11y',
params: {
a11y: {
enabled: false,
notificationclass: 'swiper-notification',
prevslidemessage: 'previous slide',
nextslidemessage: 'next slide',
firstslidemessage: 'this is the first slide',
lastslidemessage: 'this is the last slide',
paginationbulletmessage: 'go to slide {{index}}',
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
a11y: {
liveregion: $$1(("")),
},
});
object.keys(a11y).foreach(function (methodname) {
swiper.a11y[methodname] = a11y[methodname].bind(swiper);
});
},
on: {
init: function init() {
var swiper = this;
if (!swiper.params.a11y.enabled) { return; }
swiper.a11y.init();
swiper.a11y.updatenavigation();
},
toedge: function toedge() {
var swiper = this;
if (!swiper.params.a11y.enabled) { return; }
swiper.a11y.updatenavigation();
},
fromedge: function fromedge() {
var swiper = this;
if (!swiper.params.a11y.enabled) { return; }
swiper.a11y.updatenavigation();
},
paginationupdate: function paginationupdate() {
var swiper = this;
if (!swiper.params.a11y.enabled) { return; }
swiper.a11y.updatepagination();
},
destroy: function destroy() {
var swiper = this;
if (!swiper.params.a11y.enabled) { return; }
swiper.a11y.destroy();
},
},
};
var history = {
init: function init() {
var swiper = this;
if (!swiper.params.history) { return; }
if (!win.history || !win.history.pushstate) {
swiper.params.history.enabled = false;
swiper.params.hashnavigation.enabled = true;
return;
}
var history = swiper.history;
history.initialized = true;
history.paths = history.getpathvalues();
if (!history.paths.key && !history.paths.value) { return; }
history.scrolltoslide(0, history.paths.value, swiper.params.runcallbacksoninit);
if (!swiper.params.history.replacestate) {
win.addeventlistener('popstate', swiper.history.sethistorypopstate);
}
},
destroy: function destroy() {
var swiper = this;
if (!swiper.params.history.replacestate) {
win.removeeventlistener('popstate', swiper.history.sethistorypopstate);
}
},
sethistorypopstate: function sethistorypopstate() {
var swiper = this;
swiper.history.paths = history.getpathvalues();
swiper.history.scrolltoslide(swiper.params.speed, swiper.history.paths.value, false);
},
getpathvalues: function getpathvalues() {
var patharray = win.location.pathname.slice(1).split('/').filter(function (part) { return part !== ''; });
var total = patharray.length;
var key = patharray[total - 2];
var value = patharray[total - 1];
return { key: key, value: value };
},
sethistory: function sethistory(key, index) {
var swiper = this;
if (!swiper.history.initialized || !swiper.params.history.enabled) { return; }
var slide = swiper.slides.eq(index);
var value = history.slugify(slide.attr('data-history'));
if (!win.location.pathname.includes(key)) {
value = key + "/" + value;
}
var currentstate = win.history.state;
if (currentstate && currentstate.value === value) {
return;
}
if (swiper.params.history.replacestate) {
win.history.replacestate({ value: value }, null, value);
} else {
win.history.pushstate({ value: value }, null, value);
}
},
slugify: function slugify(text) {
return text.tostring().tolowercase()
.replace(/\s+/g, '-')
.replace(/[^\w-]+/g, '')
.replace(/--+/g, '-')
.replace(/^-+/, '')
.replace(/-+$/, '');
},
scrolltoslide: function scrolltoslide(speed, value, runcallbacks) {
var swiper = this;
if (value) {
for (var i = 0, length = swiper.slides.length; i < length; i += 1) {
var slide = swiper.slides.eq(i);
var slidehistory = history.slugify(slide.attr('data-history'));
if (slidehistory === value && !slide.hasclass(swiper.params.slideduplicateclass)) {
var index = slide.index();
swiper.slideto(index, speed, runcallbacks);
}
}
} else {
swiper.slideto(0, speed, runcallbacks);
}
},
};
var history$1 = {
name: 'history',
params: {
history: {
enabled: false,
replacestate: false,
key: 'slides',
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
history: {
init: history.init.bind(swiper),
sethistory: history.sethistory.bind(swiper),
sethistorypopstate: history.sethistorypopstate.bind(swiper),
scrolltoslide: history.scrolltoslide.bind(swiper),
destroy: history.destroy.bind(swiper),
},
});
},
on: {
init: function init() {
var swiper = this;
if (swiper.params.history.enabled) {
swiper.history.init();
}
},
destroy: function destroy() {
var swiper = this;
if (swiper.params.history.enabled) {
swiper.history.destroy();
}
},
transitionend: function transitionend() {
var swiper = this;
if (swiper.history.initialized) {
swiper.history.sethistory(swiper.params.history.key, swiper.activeindex);
}
},
},
};
var hashnavigation = {
onhashcange: function onhashcange() {
var swiper = this;
var newhash = doc.location.hash.replace('#', '');
var activeslidehash = swiper.slides.eq(swiper.activeindex).attr('data-hash');
if (newhash !== activeslidehash) {
swiper.slideto(swiper.$wrapperel.children(("." + (swiper.params.slideclass) + "[data-hash=\"" + newhash + "\"]")).index());
}
},
sethash: function sethash() {
var swiper = this;
if (!swiper.hashnavigation.initialized || !swiper.params.hashnavigation.enabled) { return; }
if (swiper.params.hashnavigation.replacestate && win.history && win.history.replacestate) {
win.history.replacestate(null, null, (("#" + (swiper.slides.eq(swiper.activeindex).attr('data-hash'))) || ''));
} else {
var slide = swiper.slides.eq(swiper.activeindex);
var hash = slide.attr('data-hash') || slide.attr('data-history');
doc.location.hash = hash || '';
}
},
init: function init() {
var swiper = this;
if (!swiper.params.hashnavigation.enabled || (swiper.params.history && swiper.params.history.enabled)) { return; }
swiper.hashnavigation.initialized = true;
var hash = doc.location.hash.replace('#', '');
if (hash) {
var speed = 0;
for (var i = 0, length = swiper.slides.length; i < length; i += 1) {
var slide = swiper.slides.eq(i);
var slidehash = slide.attr('data-hash') || slide.attr('data-history');
if (slidehash === hash && !slide.hasclass(swiper.params.slideduplicateclass)) {
var index = slide.index();
swiper.slideto(index, speed, swiper.params.runcallbacksoninit, true);
}
}
}
if (swiper.params.hashnavigation.watchstate) {
$$1(win).on('hashchange', swiper.hashnavigation.onhashcange);
}
},
destroy: function destroy() {
var swiper = this;
if (swiper.params.hashnavigation.watchstate) {
$$1(win).off('hashchange', swiper.hashnavigation.onhashcange);
}
},
};
var hashnavigation$1 = {
name: 'hash-navigation',
params: {
hashnavigation: {
enabled: false,
replacestate: false,
watchstate: false,
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
hashnavigation: {
initialized: false,
init: hashnavigation.init.bind(swiper),
destroy: hashnavigation.destroy.bind(swiper),
sethash: hashnavigation.sethash.bind(swiper),
onhashcange: hashnavigation.onhashcange.bind(swiper),
},
});
},
on: {
init: function init() {
var swiper = this;
if (swiper.params.hashnavigation.enabled) {
swiper.hashnavigation.init();
}
},
destroy: function destroy() {
var swiper = this;
if (swiper.params.hashnavigation.enabled) {
swiper.hashnavigation.destroy();
}
},
transitionend: function transitionend() {
var swiper = this;
if (swiper.hashnavigation.initialized) {
swiper.hashnavigation.sethash();
}
},
},
};
var autoplay = {
run: function run() {
var swiper = this;
var $activeslideel = swiper.slides.eq(swiper.activeindex);
var delay = swiper.params.autoplay.delay;
if ($activeslideel.attr('data-swiper-autoplay')) {
delay = $activeslideel.attr('data-swiper-autoplay') || swiper.params.autoplay.delay;
}
swiper.autoplay.timeout = utils.nexttick(function () {
if (swiper.params.loop) {
swiper.loopfix();
swiper.slidenext(swiper.params.speed, true, true);
swiper.emit('autoplay');
} else if (!swiper.isend) {
swiper.slidenext(swiper.params.speed, true, true);
swiper.emit('autoplay');
} else if (!swiper.params.autoplay.stoponlastslide) {
swiper.slideto(0, swiper.params.speed, true, true);
swiper.emit('autoplay');
} else {
swiper.autoplay.stop();
}
}, delay);
},
start: function start() {
var swiper = this;
if (typeof swiper.autoplay.timeout !== 'undefined') { return false; }
if (swiper.autoplay.running) { return false; }
swiper.autoplay.running = true;
swiper.emit('autoplaystart');
swiper.autoplay.run();
return true;
},
stop: function stop() {
var swiper = this;
if (!swiper.autoplay.running) { return false; }
if (typeof swiper.autoplay.timeout === 'undefined') { return false; }
if (swiper.autoplay.timeout) {
cleartimeout(swiper.autoplay.timeout);
swiper.autoplay.timeout = undefined;
}
swiper.autoplay.running = false;
swiper.emit('autoplaystop');
return true;
},
pause: function pause(speed) {
var swiper = this;
if (!swiper.autoplay.running) { return; }
if (swiper.autoplay.paused) { return; }
if (swiper.autoplay.timeout) { cleartimeout(swiper.autoplay.timeout); }
swiper.autoplay.paused = true;
if (speed === 0) {
swiper.autoplay.paused = false;
swiper.autoplay.run();
} else {
swiper.$wrapperel.transitionend(function () {
if (!swiper || swiper.destroyed) { return; }
swiper.autoplay.paused = false;
if (!swiper.autoplay.running) {
swiper.autoplay.stop();
} else {
swiper.autoplay.run();
}
});
}
},
};
var autoplay$1 = {
name: 'autoplay',
params: {
autoplay: {
enabled: false,
delay: 3000,
disableoninteraction: true,
stoponlastslide: false,
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
autoplay: {
running: false,
paused: false,
run: autoplay.run.bind(swiper),
start: autoplay.start.bind(swiper),
stop: autoplay.stop.bind(swiper),
pause: autoplay.pause.bind(swiper),
},
});
},
on: {
init: function init() {
var swiper = this;
if (swiper.params.autoplay.enabled) {
swiper.autoplay.start();
}
},
beforetransitionstart: function beforetransitionstart(speed, internal) {
var swiper = this;
if (swiper.autoplay.running) {
if (internal || !swiper.params.autoplay.disableoninteraction) {
swiper.autoplay.pause(speed);
} else {
swiper.autoplay.stop();
}
}
},
sliderfirstmove: function sliderfirstmove() {
var swiper = this;
if (swiper.autoplay.running) {
if (swiper.params.autoplay.disableoninteraction) {
swiper.autoplay.stop();
} else {
swiper.autoplay.pause();
}
}
},
destroy: function destroy() {
var swiper = this;
if (swiper.autoplay.running) {
swiper.autoplay.stop();
}
},
},
};
var fade = {
settranslate: function settranslate() {
var swiper = this;
var slides = swiper.slides;
for (var i = 0; i < slides.length; i += 1) {
var $slideel = swiper.slides.eq(i);
var offset = $slideel[0].swiperslideoffset;
var tx = -offset;
if (!swiper.params.virtualtranslate) { tx -= swiper.translate; }
var ty = 0;
if (!swiper.ishorizontal()) {
ty = tx;
tx = 0;
}
var slideopacity = swiper.params.fadeeffect.crossfade ?
math.max(1 - math.abs($slideel[0].progress), 0) :
1 + math.min(math.max($slideel[0].progress, -1), 0);
$slideel
.css({
opacity: slideopacity,
})
.transform(("translate3d(" + tx + "px, " + ty + "px, 0px)"));
}
},
settransition: function settransition(duration) {
var swiper = this;
var slides = swiper.slides;
var $wrapperel = swiper.$wrapperel;
slides.transition(duration);
if (swiper.params.virtualtranslate && duration !== 0) {
var eventtriggered = false;
slides.transitionend(function () {
if (eventtriggered) { return; }
if (!swiper || swiper.destroyed) { return; }
eventtriggered = true;
swiper.animating = false;
var triggerevents = ['webkittransitionend', 'transitionend'];
for (var i = 0; i < triggerevents.length; i += 1) {
$wrapperel.trigger(triggerevents[i]);
}
});
}
},
};
var effectfade = {
name: 'effect-fade',
params: {
fadeeffect: {
crossfade: false,
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
fadeeffect: {
settranslate: fade.settranslate.bind(swiper),
settransition: fade.settransition.bind(swiper),
},
});
},
on: {
beforeinit: function beforeinit() {
var swiper = this;
if (swiper.params.effect !== 'fade') { return; }
swiper.classnames.push(((swiper.params.containermodifierclass) + "fade"));
var overwriteparams = {
slidesperview: 1,
slidespercolumn: 1,
slidespergroup: 1,
watchslidesprogress: true,
spacebetween: 0,
virtualtranslate: true,
};
utils.extend(swiper.params, overwriteparams);
utils.extend(swiper.originalparams, overwriteparams);
},
settranslate: function settranslate() {
var swiper = this;
if (swiper.params.effect !== 'fade') { return; }
swiper.fadeeffect.settranslate();
},
settransition: function settransition(duration) {
var swiper = this;
if (swiper.params.effect !== 'fade') { return; }
swiper.fadeeffect.settransition(duration);
},
},
};
var cube = {
settranslate: function settranslate() {
var swiper = this;
var $el = swiper.$el;
var $wrapperel = swiper.$wrapperel;
var slides = swiper.slides;
var swiperwidth = swiper.width;
var swiperheight = swiper.height;
var rtl = swiper.rtl;
var swipersize = swiper.size;
var params = swiper.params.cubeeffect;
var ishorizontal = swiper.ishorizontal();
var isvirtual = swiper.virtual && swiper.params.virtual.enabled;
var wrapperrotate = 0;
var $cubeshadowel;
if (params.shadow) {
if (ishorizontal) {
$cubeshadowel = $wrapperel.find('.swiper-cube-shadow');
if ($cubeshadowel.length === 0) {
$cubeshadowel = $$1('');
$wrapperel.append($cubeshadowel);
}
$cubeshadowel.css({ height: (swiperwidth + "px") });
} else {
$cubeshadowel = $el.find('.swiper-cube-shadow');
if ($cubeshadowel.length === 0) {
$cubeshadowel = $$1('');
$el.append($cubeshadowel);
}
}
}
for (var i = 0; i < slides.length; i += 1) {
var $slideel = slides.eq(i);
var slideindex = i;
if (isvirtual) {
slideindex = parseint($slideel.attr('data-swiper-slide-index'), 10);
}
var slideangle = slideindex * 90;
var round = math.floor(slideangle / 360);
if (rtl) {
slideangle = -slideangle;
round = math.floor(-slideangle / 360);
}
var progress = math.max(math.min($slideel[0].progress, 1), -1);
var tx = 0;
var ty = 0;
var tz = 0;
if (slideindex % 4 === 0) {
tx = -round * 4 * swipersize;
tz = 0;
} else if ((slideindex - 1) % 4 === 0) {
tx = 0;
tz = -round * 4 * swipersize;
} else if ((slideindex - 2) % 4 === 0) {
tx = swipersize + (round * 4 * swipersize);
tz = swipersize;
} else if ((slideindex - 3) % 4 === 0) {
tx = -swipersize;
tz = (3 * swipersize) + (swipersize * 4 * round);
}
if (rtl) {
tx = -tx;
}
if (!ishorizontal) {
ty = tx;
tx = 0;
}
var transform = "rotatex(" + (ishorizontal ? 0 : -slideangle) + "deg) rotatey(" + (ishorizontal ? slideangle : 0) + "deg) translate3d(" + tx + "px, " + ty + "px, " + tz + "px)";
if (progress <= 1 && progress > -1) {
wrapperrotate = (slideindex * 90) + (progress * 90);
if (rtl) { wrapperrotate = (-slideindex * 90) - (progress * 90); }
}
$slideel.transform(transform);
if (params.slideshadows) {
// set shadows
var shadowbefore = ishorizontal ? $slideel.find('.swiper-slide-shadow-left') : $slideel.find('.swiper-slide-shadow-top');
var shadowafter = ishorizontal ? $slideel.find('.swiper-slide-shadow-right') : $slideel.find('.swiper-slide-shadow-bottom');
if (shadowbefore.length === 0) {
shadowbefore = $$1((""));
$slideel.append(shadowbefore);
}
if (shadowafter.length === 0) {
shadowafter = $$1((""));
$slideel.append(shadowafter);
}
if (shadowbefore.length) { shadowbefore[0].style.opacity = math.max(-progress, 0); }
if (shadowafter.length) { shadowafter[0].style.opacity = math.max(progress, 0); }
}
}
$wrapperel.css({
'-webkit-transform-origin': ("50% 50% -" + (swipersize / 2) + "px"),
'-moz-transform-origin': ("50% 50% -" + (swipersize / 2) + "px"),
'-ms-transform-origin': ("50% 50% -" + (swipersize / 2) + "px"),
'transform-origin': ("50% 50% -" + (swipersize / 2) + "px"),
});
if (params.shadow) {
if (ishorizontal) {
$cubeshadowel.transform(("translate3d(0px, " + ((swiperwidth / 2) + params.shadowoffset) + "px, " + (-swiperwidth / 2) + "px) rotatex(90deg) rotatez(0deg) scale(" + (params.shadowscale) + ")"));
} else {
var shadowangle = math.abs(wrapperrotate) - (math.floor(math.abs(wrapperrotate) / 90) * 90);
var multiplier = 1.5 - (
(math.sin((shadowangle * 2 * math.pi) / 360) / 2) +
(math.cos((shadowangle * 2 * math.pi) / 360) / 2)
);
var scale1 = params.shadowscale;
var scale2 = params.shadowscale / multiplier;
var offset = params.shadowoffset;
$cubeshadowel.transform(("scale3d(" + scale1 + ", 1, " + scale2 + ") translate3d(0px, " + ((swiperheight / 2) + offset) + "px, " + (-swiperheight / 2 / scale2) + "px) rotatex(-90deg)"));
}
}
var zfactor = (browser.issafari || browser.isuiwebview) ? (-swipersize / 2) : 0;
$wrapperel
.transform(("translate3d(0px,0," + zfactor + "px) rotatex(" + (swiper.ishorizontal() ? 0 : wrapperrotate) + "deg) rotatey(" + (swiper.ishorizontal() ? -wrapperrotate : 0) + "deg)"));
},
settransition: function settransition(duration) {
var swiper = this;
var $el = swiper.$el;
var slides = swiper.slides;
slides
.transition(duration)
.find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left')
.transition(duration);
if (swiper.params.cubeeffect.shadow && !swiper.ishorizontal()) {
$el.find('.swiper-cube-shadow').transition(duration);
}
},
};
var effectcube = {
name: 'effect-cube',
params: {
cubeeffect: {
slideshadows: true,
shadow: true,
shadowoffset: 20,
shadowscale: 0.94,
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
cubeeffect: {
settranslate: cube.settranslate.bind(swiper),
settransition: cube.settransition.bind(swiper),
},
});
},
on: {
beforeinit: function beforeinit() {
var swiper = this;
if (swiper.params.effect !== 'cube') { return; }
swiper.classnames.push(((swiper.params.containermodifierclass) + "cube"));
swiper.classnames.push(((swiper.params.containermodifierclass) + "3d"));
var overwriteparams = {
slidesperview: 1,
slidespercolumn: 1,
slidespergroup: 1,
watchslidesprogress: true,
resistanceratio: 0,
spacebetween: 0,
centeredslides: false,
virtualtranslate: true,
};
utils.extend(swiper.params, overwriteparams);
utils.extend(swiper.originalparams, overwriteparams);
},
settranslate: function settranslate() {
var swiper = this;
if (swiper.params.effect !== 'cube') { return; }
swiper.cubeeffect.settranslate();
},
settransition: function settransition(duration) {
var swiper = this;
if (swiper.params.effect !== 'cube') { return; }
swiper.cubeeffect.settransition(duration);
},
},
};
var flip = {
settranslate: function settranslate() {
var swiper = this;
var slides = swiper.slides;
for (var i = 0; i < slides.length; i += 1) {
var $slideel = slides.eq(i);
var progress = $slideel[0].progress;
if (swiper.params.flipeffect.limitrotation) {
progress = math.max(math.min($slideel[0].progress, 1), -1);
}
var offset = $slideel[0].swiperslideoffset;
var rotate = -180 * progress;
var rotatey = rotate;
var rotatex = 0;
var tx = -offset;
var ty = 0;
if (!swiper.ishorizontal()) {
ty = tx;
tx = 0;
rotatex = -rotatey;
rotatey = 0;
} else if (swiper.rtl) {
rotatey = -rotatey;
}
$slideel[0].style.zindex = -math.abs(math.round(progress)) + slides.length;
if (swiper.params.flipeffect.slideshadows) {
// set shadows
var shadowbefore = swiper.ishorizontal() ? $slideel.find('.swiper-slide-shadow-left') : $slideel.find('.swiper-slide-shadow-top');
var shadowafter = swiper.ishorizontal() ? $slideel.find('.swiper-slide-shadow-right') : $slideel.find('.swiper-slide-shadow-bottom');
if (shadowbefore.length === 0) {
shadowbefore = $$1((""));
$slideel.append(shadowbefore);
}
if (shadowafter.length === 0) {
shadowafter = $$1((""));
$slideel.append(shadowafter);
}
if (shadowbefore.length) { shadowbefore[0].style.opacity = math.max(-progress, 0); }
if (shadowafter.length) { shadowafter[0].style.opacity = math.max(progress, 0); }
}
$slideel
.transform(("translate3d(" + tx + "px, " + ty + "px, 0px) rotatex(" + rotatex + "deg) rotatey(" + rotatey + "deg)"));
}
},
settransition: function settransition(duration) {
var swiper = this;
var slides = swiper.slides;
var activeindex = swiper.activeindex;
var $wrapperel = swiper.$wrapperel;
slides
.transition(duration)
.find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left')
.transition(duration);
if (swiper.params.virtualtranslate && duration !== 0) {
var eventtriggered = false;
// eslint-disable-next-line
slides.eq(activeindex).transitionend(function ontransitionend() {
if (eventtriggered) { return; }
if (!swiper || swiper.destroyed) { return; }
// if (!$(this).hasclass(swiper.params.slideactiveclass)) return;
eventtriggered = true;
swiper.animating = false;
var triggerevents = ['webkittransitionend', 'transitionend'];
for (var i = 0; i < triggerevents.length; i += 1) {
$wrapperel.trigger(triggerevents[i]);
}
});
}
},
};
var effectflip = {
name: 'effect-flip',
params: {
flipeffect: {
slideshadows: true,
limitrotation: true,
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
flipeffect: {
settranslate: flip.settranslate.bind(swiper),
settransition: flip.settransition.bind(swiper),
},
});
},
on: {
beforeinit: function beforeinit() {
var swiper = this;
if (swiper.params.effect !== 'flip') { return; }
swiper.classnames.push(((swiper.params.containermodifierclass) + "flip"));
swiper.classnames.push(((swiper.params.containermodifierclass) + "3d"));
var overwriteparams = {
slidesperview: 1,
slidespercolumn: 1,
slidespergroup: 1,
watchslidesprogress: true,
spacebetween: 0,
virtualtranslate: true,
};
utils.extend(swiper.params, overwriteparams);
utils.extend(swiper.originalparams, overwriteparams);
},
settranslate: function settranslate() {
var swiper = this;
if (swiper.params.effect !== 'flip') { return; }
swiper.flipeffect.settranslate();
},
settransition: function settransition(duration) {
var swiper = this;
if (swiper.params.effect !== 'flip') { return; }
swiper.flipeffect.settransition(duration);
},
},
};
var coverflow = {
settranslate: function settranslate() {
var swiper = this;
var swiperwidth = swiper.width;
var swiperheight = swiper.height;
var slides = swiper.slides;
var $wrapperel = swiper.$wrapperel;
var slidessizesgrid = swiper.slidessizesgrid;
var params = swiper.params.coverfloweffect;
var ishorizontal = swiper.ishorizontal();
var transform = swiper.translate;
var center = ishorizontal ? -transform + (swiperwidth / 2) : -transform + (swiperheight / 2);
var rotate = ishorizontal ? params.rotate : -params.rotate;
var translate = params.depth;
// each slide offset from center
for (var i = 0, length = slides.length; i < length; i += 1) {
var $slideel = slides.eq(i);
var slidesize = slidessizesgrid[i];
var slideoffset = $slideel[0].swiperslideoffset;
var offsetmultiplier = ((center - slideoffset - (slidesize / 2)) / slidesize) * params.modifier;
var rotatey = ishorizontal ? rotate * offsetmultiplier : 0;
var rotatex = ishorizontal ? 0 : rotate * offsetmultiplier;
// var rotatez = 0
var translatez = -translate * math.abs(offsetmultiplier);
var translatey = ishorizontal ? 0 : params.stretch * (offsetmultiplier);
var translatex = ishorizontal ? params.stretch * (offsetmultiplier) : 0;
// fix for ultra small values
if (math.abs(translatex) < 0.001) { translatex = 0; }
if (math.abs(translatey) < 0.001) { translatey = 0; }
if (math.abs(translatez) < 0.001) { translatez = 0; }
if (math.abs(rotatey) < 0.001) { rotatey = 0; }
if (math.abs(rotatex) < 0.001) { rotatex = 0; }
var slidetransform = "translate3d(" + translatex + "px," + translatey + "px," + translatez + "px) rotatex(" + rotatex + "deg) rotatey(" + rotatey + "deg)";
$slideel.transform(slidetransform);
$slideel[0].style.zindex = -math.abs(math.round(offsetmultiplier)) + 1;
if (params.slideshadows) {
// set shadows
var $shadowbeforeel = ishorizontal ? $slideel.find('.swiper-slide-shadow-left') : $slideel.find('.swiper-slide-shadow-top');
var $shadowafterel = ishorizontal ? $slideel.find('.swiper-slide-shadow-right') : $slideel.find('.swiper-slide-shadow-bottom');
if ($shadowbeforeel.length === 0) {
$shadowbeforeel = $$1((""));
$slideel.append($shadowbeforeel);
}
if ($shadowafterel.length === 0) {
$shadowafterel = $$1((""));
$slideel.append($shadowafterel);
}
if ($shadowbeforeel.length) { $shadowbeforeel[0].style.opacity = offsetmultiplier > 0 ? offsetmultiplier : 0; }
if ($shadowafterel.length) { $shadowafterel[0].style.opacity = (-offsetmultiplier) > 0 ? -offsetmultiplier : 0; }
}
}
// set correct perspective for ie10
if (browser.ie) {
var ws = $wrapperel[0].style;
ws.perspectiveorigin = center + "px 50%";
}
},
settransition: function settransition(duration) {
var swiper = this;
swiper.slides
.transition(duration)
.find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left')
.transition(duration);
},
};
var effectcoverflow = {
name: 'effect-coverflow',
params: {
coverfloweffect: {
rotate: 50,
stretch: 0,
depth: 100,
modifier: 1,
slideshadows: true,
},
},
create: function create() {
var swiper = this;
utils.extend(swiper, {
coverfloweffect: {
settranslate: coverflow.settranslate.bind(swiper),
settransition: coverflow.settransition.bind(swiper),
},
});
},
on: {
beforeinit: function beforeinit() {
var swiper = this;
if (swiper.params.effect !== 'coverflow') { return; }
swiper.classnames.push(((swiper.params.containermodifierclass) + "coverflow"));
swiper.classnames.push(((swiper.params.containermodifierclass) + "3d"));
swiper.params.watchslidesprogress = true;
swiper.originalparams.watchslidesprogress = true;
},
settranslate: function settranslate() {
var swiper = this;
if (swiper.params.effect !== 'coverflow') { return; }
swiper.coverfloweffect.settranslate();
},
settransition: function settransition(duration) {
var swiper = this;
if (swiper.params.effect !== 'coverflow') { return; }
swiper.coverfloweffect.settransition(duration);
},
},
};
// swiper class
// core modules
swiper$1.use([
device$2,
support$2,
browser$2,
resize,
observer$1,
virtual$1,
keyboard$1,
mousewheel$1,
navigation$1,
pagination$1,
scrollbar$1,
parallax$1,
zoom$1,
lazy$1,
controller$1,
a11y,
history$1,
hashnavigation$1,
autoplay$1,
effectfade,
effectcube,
effectflip,
effectcoverflow
]);
return swiper$1;
})));