swiper.js 267 KB

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