111
25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

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