slick.js 87 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011
  1. /*
  2. _ _ _ _
  3. ___| (_) ___| | __ (_)___
  4. / __| | |/ __| |/ / | / __|
  5. \__ \ | | (__| < _ | \__ \
  6. |___/_|_|\___|_|\_(_)/ |___/
  7. |__/
  8. Version: 1.8.0
  9. Author: Ken Wheeler
  10. Website: http://kenwheeler.github.io
  11. Docs: http://kenwheeler.github.io/slick
  12. Repo: http://github.com/kenwheeler/slick
  13. Issues: http://github.com/kenwheeler/slick/issues
  14. */
  15. /* global window, document, define, jQuery, setInterval, clearInterval */
  16. ;(function(factory) {
  17. 'use strict';
  18. if (typeof define === 'function' && define.amd) {
  19. define(['jquery'], factory);
  20. } else if (typeof exports !== 'undefined') {
  21. module.exports = factory(require('jquery'));
  22. } else {
  23. factory(jQuery);
  24. }
  25. }(function($) {
  26. 'use strict';
  27. var Slick = window.Slick || {};
  28. Slick = (function() {
  29. var instanceUid = 0;
  30. function Slick(element, settings) {
  31. var _ = this, dataSettings;
  32. _.defaults = {
  33. accessibility: true,
  34. adaptiveHeight: false,
  35. appendArrows: $(element),
  36. appendDots: $(element),
  37. arrows: true,
  38. asNavFor: null,
  39. prevArrow: '<button class="slick-prev" aria-label="Previous" type="button">Previous</button>',
  40. nextArrow: '<button class="slick-next" aria-label="Next" type="button">Next</button>',
  41. autoplay: false,
  42. autoplaySpeed: 3000,
  43. centerMode: false,
  44. centerPadding: '50px',
  45. cssEase: 'ease',
  46. customPaging: function(slider, i) {
  47. return $('<button type="button" />').text(i + 1);
  48. },
  49. dots: false,
  50. dotsClass: 'slick-dots',
  51. draggable: true,
  52. easing: 'linear',
  53. edgeFriction: 0.35,
  54. fade: false,
  55. focusOnSelect: false,
  56. focusOnChange: false,
  57. infinite: true,
  58. initialSlide: 0,
  59. lazyLoad: 'ondemand',
  60. mobileFirst: false,
  61. pauseOnHover: true,
  62. pauseOnFocus: true,
  63. pauseOnDotsHover: false,
  64. respondTo: 'window',
  65. responsive: null,
  66. rows: 1,
  67. rtl: false,
  68. slide: '',
  69. slidesPerRow: 1,
  70. slidesToShow: 1,
  71. slidesToScroll: 1,
  72. speed: 500,
  73. swipe: true,
  74. swipeToSlide: false,
  75. touchMove: true,
  76. touchThreshold: 5,
  77. useCSS: true,
  78. useTransform: true,
  79. variableWidth: false,
  80. vertical: false,
  81. verticalSwiping: false,
  82. waitForAnimate: true,
  83. zIndex: 1000
  84. };
  85. _.initials = {
  86. animating: false,
  87. dragging: false,
  88. autoPlayTimer: null,
  89. currentDirection: 0,
  90. currentLeft: null,
  91. currentSlide: 0,
  92. direction: 1,
  93. $dots: null,
  94. listWidth: null,
  95. listHeight: null,
  96. loadIndex: 0,
  97. $nextArrow: null,
  98. $prevArrow: null,
  99. scrolling: false,
  100. slideCount: null,
  101. slideWidth: null,
  102. $slideTrack: null,
  103. $slides: null,
  104. sliding: false,
  105. slideOffset: 0,
  106. swipeLeft: null,
  107. swiping: false,
  108. $list: null,
  109. touchObject: {},
  110. transformsEnabled: false,
  111. unslicked: false
  112. };
  113. $.extend(_, _.initials);
  114. _.activeBreakpoint = null;
  115. _.animType = null;
  116. _.animProp = null;
  117. _.breakpoints = [];
  118. _.breakpointSettings = [];
  119. _.cssTransitions = false;
  120. _.focussed = false;
  121. _.interrupted = false;
  122. _.hidden = 'hidden';
  123. _.paused = true;
  124. _.positionProp = null;
  125. _.respondTo = null;
  126. _.rowCount = 1;
  127. _.shouldClick = true;
  128. _.$slider = $(element);
  129. _.$slidesCache = null;
  130. _.transformType = null;
  131. _.transitionType = null;
  132. _.visibilityChange = 'visibilitychange';
  133. _.windowWidth = 0;
  134. _.windowTimer = null;
  135. dataSettings = $(element).data('slick') || {};
  136. _.options = $.extend({}, _.defaults, settings, dataSettings);
  137. _.currentSlide = _.options.initialSlide;
  138. _.originalSettings = _.options;
  139. if (typeof document.mozHidden !== 'undefined') {
  140. _.hidden = 'mozHidden';
  141. _.visibilityChange = 'mozvisibilitychange';
  142. } else if (typeof document.webkitHidden !== 'undefined') {
  143. _.hidden = 'webkitHidden';
  144. _.visibilityChange = 'webkitvisibilitychange';
  145. }
  146. _.autoPlay = $.proxy(_.autoPlay, _);
  147. _.autoPlayClear = $.proxy(_.autoPlayClear, _);
  148. _.autoPlayIterator = $.proxy(_.autoPlayIterator, _);
  149. _.changeSlide = $.proxy(_.changeSlide, _);
  150. _.clickHandler = $.proxy(_.clickHandler, _);
  151. _.selectHandler = $.proxy(_.selectHandler, _);
  152. _.setPosition = $.proxy(_.setPosition, _);
  153. _.swipeHandler = $.proxy(_.swipeHandler, _);
  154. _.dragHandler = $.proxy(_.dragHandler, _);
  155. _.keyHandler = $.proxy(_.keyHandler, _);
  156. _.instanceUid = instanceUid++;
  157. // A simple way to check for HTML strings
  158. // Strict HTML recognition (must start with <)
  159. // Extracted from jQuery v1.11 source
  160. _.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/;
  161. _.registerBreakpoints();
  162. _.init(true);
  163. }
  164. return Slick;
  165. }());
  166. Slick.prototype.activateADA = function() {
  167. var _ = this;
  168. _.$slideTrack.find('.slick-active').attr({
  169. 'aria-hidden': 'false'
  170. }).find('a, input, button, select').attr({
  171. 'tabindex': '0'
  172. });
  173. };
  174. Slick.prototype.addSlide = Slick.prototype.slickAdd = function(markup, index, addBefore) {
  175. var _ = this;
  176. if (typeof(index) === 'boolean') {
  177. addBefore = index;
  178. index = null;
  179. } else if (index < 0 || (index >= _.slideCount)) {
  180. return false;
  181. }
  182. _.unload();
  183. if (typeof(index) === 'number') {
  184. if (index === 0 && _.$slides.length === 0) {
  185. $(markup).appendTo(_.$slideTrack);
  186. } else if (addBefore) {
  187. $(markup).insertBefore(_.$slides.eq(index));
  188. } else {
  189. $(markup).insertAfter(_.$slides.eq(index));
  190. }
  191. } else {
  192. if (addBefore === true) {
  193. $(markup).prependTo(_.$slideTrack);
  194. } else {
  195. $(markup).appendTo(_.$slideTrack);
  196. }
  197. }
  198. _.$slides = _.$slideTrack.children(this.options.slide);
  199. _.$slideTrack.children(this.options.slide).detach();
  200. _.$slideTrack.append(_.$slides);
  201. _.$slides.each(function(index, element) {
  202. $(element).attr('data-slick-index', index);
  203. });
  204. _.$slidesCache = _.$slides;
  205. _.reinit();
  206. };
  207. Slick.prototype.animateHeight = function() {
  208. var _ = this;
  209. if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
  210. var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
  211. _.$list.animate({
  212. height: targetHeight
  213. }, _.options.speed);
  214. }
  215. };
  216. Slick.prototype.animateSlide = function(targetLeft, callback) {
  217. var animProps = {},
  218. _ = this;
  219. _.animateHeight();
  220. if (_.options.rtl === true && _.options.vertical === false) {
  221. targetLeft = -targetLeft;
  222. }
  223. if (_.transformsEnabled === false) {
  224. if (_.options.vertical === false) {
  225. _.$slideTrack.animate({
  226. left: targetLeft
  227. }, _.options.speed, _.options.easing, callback);
  228. } else {
  229. _.$slideTrack.animate({
  230. top: targetLeft
  231. }, _.options.speed, _.options.easing, callback);
  232. }
  233. } else {
  234. if (_.cssTransitions === false) {
  235. if (_.options.rtl === true) {
  236. _.currentLeft = -(_.currentLeft);
  237. }
  238. $({
  239. animStart: _.currentLeft
  240. }).animate({
  241. animStart: targetLeft
  242. }, {
  243. duration: _.options.speed,
  244. easing: _.options.easing,
  245. step: function(now) {
  246. now = Math.ceil(now);
  247. if (_.options.vertical === false) {
  248. animProps[_.animType] = 'translate(' +
  249. now + 'px, 0px)';
  250. _.$slideTrack.css(animProps);
  251. } else {
  252. animProps[_.animType] = 'translate(0px,' +
  253. now + 'px)';
  254. _.$slideTrack.css(animProps);
  255. }
  256. },
  257. complete: function() {
  258. if (callback) {
  259. callback.call();
  260. }
  261. }
  262. });
  263. } else {
  264. _.applyTransition();
  265. targetLeft = Math.ceil(targetLeft);
  266. if (_.options.vertical === false) {
  267. animProps[_.animType] = 'translate3d(' + targetLeft + 'px, 0px, 0px)';
  268. } else {
  269. animProps[_.animType] = 'translate3d(0px,' + targetLeft + 'px, 0px)';
  270. }
  271. _.$slideTrack.css(animProps);
  272. if (callback) {
  273. setTimeout(function() {
  274. _.disableTransition();
  275. callback.call();
  276. }, _.options.speed);
  277. }
  278. }
  279. }
  280. };
  281. Slick.prototype.getNavTarget = function() {
  282. var _ = this,
  283. asNavFor = _.options.asNavFor;
  284. if ( asNavFor && asNavFor !== null ) {
  285. asNavFor = $(asNavFor).not(_.$slider);
  286. }
  287. return asNavFor;
  288. };
  289. Slick.prototype.asNavFor = function(index) {
  290. var _ = this,
  291. asNavFor = _.getNavTarget();
  292. if ( asNavFor !== null && typeof asNavFor === 'object' ) {
  293. asNavFor.each(function() {
  294. var target = $(this).slick('getSlick');
  295. if(!target.unslicked) {
  296. target.slideHandler(index, true);
  297. }
  298. });
  299. }
  300. };
  301. Slick.prototype.applyTransition = function(slide) {
  302. var _ = this,
  303. transition = {};
  304. if (_.options.fade === false) {
  305. transition[_.transitionType] = _.transformType + ' ' + _.options.speed + 'ms ' + _.options.cssEase;
  306. } else {
  307. transition[_.transitionType] = 'opacity ' + _.options.speed + 'ms ' + _.options.cssEase;
  308. }
  309. if (_.options.fade === false) {
  310. _.$slideTrack.css(transition);
  311. } else {
  312. _.$slides.eq(slide).css(transition);
  313. }
  314. };
  315. Slick.prototype.autoPlay = function() {
  316. var _ = this;
  317. _.autoPlayClear();
  318. if ( _.slideCount > _.options.slidesToShow ) {
  319. _.autoPlayTimer = setInterval( _.autoPlayIterator, _.options.autoplaySpeed );
  320. }
  321. };
  322. Slick.prototype.autoPlayClear = function() {
  323. var _ = this;
  324. if (_.autoPlayTimer) {
  325. clearInterval(_.autoPlayTimer);
  326. }
  327. };
  328. Slick.prototype.autoPlayIterator = function() {
  329. var _ = this,
  330. slideTo = _.currentSlide + _.options.slidesToScroll;
  331. if ( !_.paused && !_.interrupted && !_.focussed ) {
  332. if ( _.options.infinite === false ) {
  333. if ( _.direction === 1 && ( _.currentSlide + 1 ) === ( _.slideCount - 1 )) {
  334. _.direction = 0;
  335. }
  336. else if ( _.direction === 0 ) {
  337. slideTo = _.currentSlide - _.options.slidesToScroll;
  338. if ( _.currentSlide - 1 === 0 ) {
  339. _.direction = 1;
  340. }
  341. }
  342. }
  343. _.slideHandler( slideTo );
  344. }
  345. };
  346. Slick.prototype.buildArrows = function() {
  347. var _ = this;
  348. if (_.options.arrows === true ) {
  349. _.$prevArrow = $(_.options.prevArrow).addClass('slick-arrow');
  350. _.$nextArrow = $(_.options.nextArrow).addClass('slick-arrow');
  351. if( _.slideCount > _.options.slidesToShow ) {
  352. _.$prevArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');
  353. _.$nextArrow.removeClass('slick-hidden').removeAttr('aria-hidden tabindex');
  354. if (_.htmlExpr.test(_.options.prevArrow)) {
  355. _.$prevArrow.prependTo(_.options.appendArrows);
  356. }
  357. if (_.htmlExpr.test(_.options.nextArrow)) {
  358. _.$nextArrow.appendTo(_.options.appendArrows);
  359. }
  360. if (_.options.infinite !== true) {
  361. _.$prevArrow
  362. .addClass('slick-disabled')
  363. .attr('aria-disabled', 'true');
  364. }
  365. } else {
  366. _.$prevArrow.add( _.$nextArrow )
  367. .addClass('slick-hidden')
  368. .attr({
  369. 'aria-disabled': 'true',
  370. 'tabindex': '-1'
  371. });
  372. }
  373. }
  374. };
  375. Slick.prototype.buildDots = function() {
  376. var _ = this,
  377. i, dot;
  378. if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
  379. _.$slider.addClass('slick-dotted');
  380. dot = $('<ul />').addClass(_.options.dotsClass);
  381. for (i = 0; i <= _.getDotCount(); i += 1) {
  382. dot.append($('<li />').append(_.options.customPaging.call(this, _, i)));
  383. }
  384. _.$dots = dot.appendTo(_.options.appendDots);
  385. _.$dots.find('li').first().addClass('slick-active');
  386. }
  387. };
  388. Slick.prototype.buildOut = function() {
  389. var _ = this;
  390. _.$slides =
  391. _.$slider
  392. .children( _.options.slide + ':not(.slick-cloned)')
  393. .addClass('slick-slide');
  394. _.slideCount = _.$slides.length;
  395. _.$slides.each(function(index, element) {
  396. $(element)
  397. .attr('data-slick-index', index)
  398. .data('originalStyling', $(element).attr('style') || '');
  399. });
  400. _.$slider.addClass('slick-slider');
  401. _.$slideTrack = (_.slideCount === 0) ?
  402. $('<div class="slick-track"/>').appendTo(_.$slider) :
  403. _.$slides.wrapAll('<div class="slick-track"/>').parent();
  404. _.$list = _.$slideTrack.wrap(
  405. '<div class="slick-list"/>').parent();
  406. _.$slideTrack.css('opacity', 0);
  407. if (_.options.centerMode === true || _.options.swipeToSlide === true) {
  408. _.options.slidesToScroll = 1;
  409. }
  410. $('img[data-lazy]', _.$slider).not('[src]').addClass('slick-loading');
  411. _.setupInfinite();
  412. _.buildArrows();
  413. _.buildDots();
  414. _.updateDots();
  415. _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0);
  416. if (_.options.draggable === true) {
  417. _.$list.addClass('draggable');
  418. }
  419. };
  420. Slick.prototype.buildRows = function() {
  421. var _ = this, a, b, c, newSlides, numOfSlides, originalSlides,slidesPerSection;
  422. newSlides = document.createDocumentFragment();
  423. originalSlides = _.$slider.children();
  424. if(_.options.rows > 0) {
  425. slidesPerSection = _.options.slidesPerRow * _.options.rows;
  426. numOfSlides = Math.ceil(
  427. originalSlides.length / slidesPerSection
  428. );
  429. for(a = 0; a < numOfSlides; a++){
  430. var slide = document.createElement('div');
  431. for(b = 0; b < _.options.rows; b++) {
  432. var row = document.createElement('div');
  433. for(c = 0; c < _.options.slidesPerRow; c++) {
  434. var target = (a * slidesPerSection + ((b * _.options.slidesPerRow) + c));
  435. if (originalSlides.get(target)) {
  436. row.appendChild(originalSlides.get(target));
  437. }
  438. }
  439. slide.appendChild(row);
  440. }
  441. newSlides.appendChild(slide);
  442. }
  443. _.$slider.empty().append(newSlides);
  444. _.$slider.children().children().children()
  445. .css({
  446. 'width':(100 / _.options.slidesPerRow) + '%',
  447. 'display': 'inline-block'
  448. });
  449. }
  450. };
  451. Slick.prototype.checkResponsive = function(initial, forceUpdate) {
  452. var _ = this,
  453. breakpoint, targetBreakpoint, respondToWidth, triggerBreakpoint = false;
  454. var sliderWidth = _.$slider.width();
  455. var windowWidth = window.innerWidth || $(window).width();
  456. if (_.respondTo === 'window') {
  457. respondToWidth = windowWidth;
  458. } else if (_.respondTo === 'slider') {
  459. respondToWidth = sliderWidth;
  460. } else if (_.respondTo === 'min') {
  461. respondToWidth = Math.min(windowWidth, sliderWidth);
  462. }
  463. if ( _.options.responsive &&
  464. _.options.responsive.length &&
  465. _.options.responsive !== null) {
  466. targetBreakpoint = null;
  467. for (breakpoint in _.breakpoints) {
  468. if (_.breakpoints.hasOwnProperty(breakpoint)) {
  469. if (_.originalSettings.mobileFirst === false) {
  470. if (respondToWidth < _.breakpoints[breakpoint]) {
  471. targetBreakpoint = _.breakpoints[breakpoint];
  472. }
  473. } else {
  474. if (respondToWidth > _.breakpoints[breakpoint]) {
  475. targetBreakpoint = _.breakpoints[breakpoint];
  476. }
  477. }
  478. }
  479. }
  480. if (targetBreakpoint !== null) {
  481. if (_.activeBreakpoint !== null) {
  482. if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) {
  483. _.activeBreakpoint =
  484. targetBreakpoint;
  485. if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
  486. _.unslick(targetBreakpoint);
  487. } else {
  488. _.options = $.extend({}, _.originalSettings,
  489. _.breakpointSettings[
  490. targetBreakpoint]);
  491. if (initial === true) {
  492. _.currentSlide = _.options.initialSlide;
  493. }
  494. _.refresh(initial);
  495. }
  496. triggerBreakpoint = targetBreakpoint;
  497. }
  498. } else {
  499. _.activeBreakpoint = targetBreakpoint;
  500. if (_.breakpointSettings[targetBreakpoint] === 'unslick') {
  501. _.unslick(targetBreakpoint);
  502. } else {
  503. _.options = $.extend({}, _.originalSettings,
  504. _.breakpointSettings[
  505. targetBreakpoint]);
  506. if (initial === true) {
  507. _.currentSlide = _.options.initialSlide;
  508. }
  509. _.refresh(initial);
  510. }
  511. triggerBreakpoint = targetBreakpoint;
  512. }
  513. } else {
  514. if (_.activeBreakpoint !== null) {
  515. _.activeBreakpoint = null;
  516. _.options = _.originalSettings;
  517. if (initial === true) {
  518. _.currentSlide = _.options.initialSlide;
  519. }
  520. _.refresh(initial);
  521. triggerBreakpoint = targetBreakpoint;
  522. }
  523. }
  524. // only trigger breakpoints during an actual break. not on initialize.
  525. if( !initial && triggerBreakpoint !== false ) {
  526. _.$slider.trigger('breakpoint', [_, triggerBreakpoint]);
  527. }
  528. }
  529. };
  530. Slick.prototype.changeSlide = function(event, dontAnimate) {
  531. var _ = this,
  532. $target = $(event.currentTarget),
  533. indexOffset, slideOffset, unevenOffset;
  534. // If target is a link, prevent default action.
  535. if($target.is('a')) {
  536. event.preventDefault();
  537. }
  538. // If target is not the <li> element (ie: a child), find the <li>.
  539. if(!$target.is('li')) {
  540. $target = $target.closest('li');
  541. }
  542. unevenOffset = (_.slideCount % _.options.slidesToScroll !== 0);
  543. indexOffset = unevenOffset ? 0 : (_.slideCount - _.currentSlide) % _.options.slidesToScroll;
  544. switch (event.data.message) {
  545. case 'previous':
  546. slideOffset = indexOffset === 0 ? _.options.slidesToScroll : _.options.slidesToShow - indexOffset;
  547. if (_.slideCount > _.options.slidesToShow) {
  548. _.slideHandler(_.currentSlide - slideOffset, false, dontAnimate);
  549. }
  550. break;
  551. case 'next':
  552. slideOffset = indexOffset === 0 ? _.options.slidesToScroll : indexOffset;
  553. if (_.slideCount > _.options.slidesToShow) {
  554. _.slideHandler(_.currentSlide + slideOffset, false, dontAnimate);
  555. }
  556. break;
  557. case 'index':
  558. var index = event.data.index === 0 ? 0 :
  559. event.data.index || $target.index() * _.options.slidesToScroll;
  560. _.slideHandler(_.checkNavigable(index), false, dontAnimate);
  561. $target.children().trigger('focus');
  562. break;
  563. default:
  564. return;
  565. }
  566. };
  567. Slick.prototype.checkNavigable = function(index) {
  568. var _ = this,
  569. navigables, prevNavigable;
  570. navigables = _.getNavigableIndexes();
  571. prevNavigable = 0;
  572. if (index > navigables[navigables.length - 1]) {
  573. index = navigables[navigables.length - 1];
  574. } else {
  575. for (var n in navigables) {
  576. if (index < navigables[n]) {
  577. index = prevNavigable;
  578. break;
  579. }
  580. prevNavigable = navigables[n];
  581. }
  582. }
  583. return index;
  584. };
  585. Slick.prototype.cleanUpEvents = function() {
  586. var _ = this;
  587. if (_.options.dots && _.$dots !== null) {
  588. $('li', _.$dots)
  589. .off('click.slick', _.changeSlide)
  590. .off('mouseenter.slick', $.proxy(_.interrupt, _, true))
  591. .off('mouseleave.slick', $.proxy(_.interrupt, _, false));
  592. if (_.options.accessibility === true) {
  593. _.$dots.off('keydown.slick', _.keyHandler);
  594. }
  595. }
  596. _.$slider.off('focus.slick blur.slick');
  597. if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
  598. _.$prevArrow && _.$prevArrow.off('click.slick', _.changeSlide);
  599. _.$nextArrow && _.$nextArrow.off('click.slick', _.changeSlide);
  600. if (_.options.accessibility === true) {
  601. _.$prevArrow && _.$prevArrow.off('keydown.slick', _.keyHandler);
  602. _.$nextArrow && _.$nextArrow.off('keydown.slick', _.keyHandler);
  603. }
  604. }
  605. _.$list.off('touchstart.slick mousedown.slick', _.swipeHandler);
  606. _.$list.off('touchmove.slick mousemove.slick', _.swipeHandler);
  607. _.$list.off('touchend.slick mouseup.slick', _.swipeHandler);
  608. _.$list.off('touchcancel.slick mouseleave.slick', _.swipeHandler);
  609. _.$list.off('click.slick', _.clickHandler);
  610. $(document).off(_.visibilityChange, _.visibility);
  611. _.cleanUpSlideEvents();
  612. if (_.options.accessibility === true) {
  613. _.$list.off('keydown.slick', _.keyHandler);
  614. }
  615. if (_.options.focusOnSelect === true) {
  616. $(_.$slideTrack).children().off('click.slick', _.selectHandler);
  617. }
  618. $(window).off('orientationchange.slick.slick-' + _.instanceUid, _.orientationChange);
  619. $(window).off('resize.slick.slick-' + _.instanceUid, _.resize);
  620. $('[draggable!=true]', _.$slideTrack).off('dragstart', _.preventDefault);
  621. $(window).off('load.slick.slick-' + _.instanceUid, _.setPosition);
  622. };
  623. Slick.prototype.cleanUpSlideEvents = function() {
  624. var _ = this;
  625. _.$list.off('mouseenter.slick', $.proxy(_.interrupt, _, true));
  626. _.$list.off('mouseleave.slick', $.proxy(_.interrupt, _, false));
  627. };
  628. Slick.prototype.cleanUpRows = function() {
  629. var _ = this, originalSlides;
  630. if(_.options.rows > 0) {
  631. originalSlides = _.$slides.children().children();
  632. originalSlides.removeAttr('style');
  633. _.$slider.empty().append(originalSlides);
  634. }
  635. };
  636. Slick.prototype.clickHandler = function(event) {
  637. var _ = this;
  638. if (_.shouldClick === false) {
  639. event.stopImmediatePropagation();
  640. event.stopPropagation();
  641. event.preventDefault();
  642. }
  643. };
  644. Slick.prototype.destroy = function(refresh) {
  645. var _ = this;
  646. _.autoPlayClear();
  647. _.touchObject = {};
  648. _.cleanUpEvents();
  649. $('.slick-cloned', _.$slider).detach();
  650. if (_.$dots) {
  651. _.$dots.remove();
  652. }
  653. if ( _.$prevArrow && _.$prevArrow.length ) {
  654. _.$prevArrow
  655. .removeClass('slick-disabled slick-arrow slick-hidden')
  656. .removeAttr('aria-hidden aria-disabled tabindex')
  657. .css('display','');
  658. if ( _.htmlExpr.test( _.options.prevArrow )) {
  659. _.$prevArrow.remove();
  660. }
  661. }
  662. if ( _.$nextArrow && _.$nextArrow.length ) {
  663. _.$nextArrow
  664. .removeClass('slick-disabled slick-arrow slick-hidden')
  665. .removeAttr('aria-hidden aria-disabled tabindex')
  666. .css('display','');
  667. if ( _.htmlExpr.test( _.options.nextArrow )) {
  668. _.$nextArrow.remove();
  669. }
  670. }
  671. if (_.$slides) {
  672. _.$slides
  673. .removeClass('slick-slide slick-active slick-center slick-visible slick-current')
  674. .removeAttr('aria-hidden')
  675. .removeAttr('data-slick-index')
  676. .each(function(){
  677. $(this).attr('style', $(this).data('originalStyling'));
  678. });
  679. _.$slideTrack.children(this.options.slide).detach();
  680. _.$slideTrack.detach();
  681. _.$list.detach();
  682. _.$slider.append(_.$slides);
  683. }
  684. _.cleanUpRows();
  685. _.$slider.removeClass('slick-slider');
  686. _.$slider.removeClass('slick-initialized');
  687. _.$slider.removeClass('slick-dotted');
  688. _.unslicked = true;
  689. if(!refresh) {
  690. _.$slider.trigger('destroy', [_]);
  691. }
  692. };
  693. Slick.prototype.disableTransition = function(slide) {
  694. var _ = this,
  695. transition = {};
  696. transition[_.transitionType] = '';
  697. if (_.options.fade === false) {
  698. _.$slideTrack.css(transition);
  699. } else {
  700. _.$slides.eq(slide).css(transition);
  701. }
  702. };
  703. Slick.prototype.fadeSlide = function(slideIndex, callback) {
  704. var _ = this;
  705. if (_.cssTransitions === false) {
  706. _.$slides.eq(slideIndex).css({
  707. zIndex: _.options.zIndex
  708. });
  709. _.$slides.eq(slideIndex).animate({
  710. opacity: 1
  711. }, _.options.speed, _.options.easing, callback);
  712. } else {
  713. _.applyTransition(slideIndex);
  714. _.$slides.eq(slideIndex).css({
  715. opacity: 1,
  716. zIndex: _.options.zIndex
  717. });
  718. if (callback) {
  719. setTimeout(function() {
  720. _.disableTransition(slideIndex);
  721. callback.call();
  722. }, _.options.speed);
  723. }
  724. }
  725. };
  726. Slick.prototype.fadeSlideOut = function(slideIndex) {
  727. var _ = this;
  728. if (_.cssTransitions === false) {
  729. _.$slides.eq(slideIndex).animate({
  730. opacity: 0,
  731. zIndex: _.options.zIndex - 2
  732. }, _.options.speed, _.options.easing);
  733. } else {
  734. _.applyTransition(slideIndex);
  735. _.$slides.eq(slideIndex).css({
  736. opacity: 0,
  737. zIndex: _.options.zIndex - 2
  738. });
  739. }
  740. };
  741. Slick.prototype.filterSlides = Slick.prototype.slickFilter = function(filter) {
  742. var _ = this;
  743. if (filter !== null) {
  744. _.$slidesCache = _.$slides;
  745. _.unload();
  746. _.$slideTrack.children(this.options.slide).detach();
  747. _.$slidesCache.filter(filter).appendTo(_.$slideTrack);
  748. _.reinit();
  749. }
  750. };
  751. Slick.prototype.focusHandler = function() {
  752. var _ = this;
  753. _.$slider
  754. .off('focus.slick blur.slick')
  755. .on('focus.slick blur.slick', '*', function(event) {
  756. event.stopImmediatePropagation();
  757. var $sf = $(this);
  758. setTimeout(function() {
  759. if( _.options.pauseOnFocus ) {
  760. _.focussed = $sf.is(':focus');
  761. _.autoPlay();
  762. }
  763. }, 0);
  764. });
  765. };
  766. Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function() {
  767. var _ = this;
  768. return _.currentSlide;
  769. };
  770. Slick.prototype.getDotCount = function() {
  771. var _ = this;
  772. var breakPoint = 0;
  773. var counter = 0;
  774. var pagerQty = 0;
  775. if (_.options.infinite === true) {
  776. if (_.slideCount <= _.options.slidesToShow) {
  777. ++pagerQty;
  778. } else {
  779. while (breakPoint < _.slideCount) {
  780. ++pagerQty;
  781. breakPoint = counter + _.options.slidesToScroll;
  782. counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
  783. }
  784. }
  785. } else if (_.options.centerMode === true) {
  786. pagerQty = _.slideCount;
  787. } else if(!_.options.asNavFor) {
  788. pagerQty = 1 + Math.ceil((_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll);
  789. }else {
  790. while (breakPoint < _.slideCount) {
  791. ++pagerQty;
  792. breakPoint = counter + _.options.slidesToScroll;
  793. counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
  794. }
  795. }
  796. return pagerQty - 1;
  797. };
  798. Slick.prototype.getLeft = function(slideIndex) {
  799. var _ = this,
  800. targetLeft,
  801. verticalHeight,
  802. verticalOffset = 0,
  803. targetSlide,
  804. coef;
  805. _.slideOffset = 0;
  806. verticalHeight = _.$slides.first().outerHeight(true);
  807. if (_.options.infinite === true) {
  808. if (_.slideCount > _.options.slidesToShow) {
  809. _.slideOffset = (_.slideWidth * _.options.slidesToShow) * -1;
  810. coef = -1
  811. if (_.options.vertical === true && _.options.centerMode === true) {
  812. if (_.options.slidesToShow === 2) {
  813. coef = -1.5;
  814. } else if (_.options.slidesToShow === 1) {
  815. coef = -2
  816. }
  817. }
  818. verticalOffset = (verticalHeight * _.options.slidesToShow) * coef;
  819. }
  820. if (_.slideCount % _.options.slidesToScroll !== 0) {
  821. if (slideIndex + _.options.slidesToScroll > _.slideCount && _.slideCount > _.options.slidesToShow) {
  822. if (slideIndex > _.slideCount) {
  823. _.slideOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * _.slideWidth) * -1;
  824. verticalOffset = ((_.options.slidesToShow - (slideIndex - _.slideCount)) * verticalHeight) * -1;
  825. } else {
  826. _.slideOffset = ((_.slideCount % _.options.slidesToScroll) * _.slideWidth) * -1;
  827. verticalOffset = ((_.slideCount % _.options.slidesToScroll) * verticalHeight) * -1;
  828. }
  829. }
  830. }
  831. } else {
  832. if (slideIndex + _.options.slidesToShow > _.slideCount) {
  833. _.slideOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * _.slideWidth;
  834. verticalOffset = ((slideIndex + _.options.slidesToShow) - _.slideCount) * verticalHeight;
  835. }
  836. }
  837. if (_.slideCount <= _.options.slidesToShow) {
  838. _.slideOffset = 0;
  839. verticalOffset = 0;
  840. }
  841. if (_.options.centerMode === true && _.slideCount <= _.options.slidesToShow) {
  842. _.slideOffset = ((_.slideWidth * Math.floor(_.options.slidesToShow)) / 2) - ((_.slideWidth * _.slideCount) / 2);
  843. } else if (_.options.centerMode === true && _.options.infinite === true) {
  844. _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth;
  845. } else if (_.options.centerMode === true) {
  846. _.slideOffset = 0;
  847. _.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2);
  848. }
  849. if (_.options.vertical === false) {
  850. targetLeft = ((slideIndex * _.slideWidth) * -1) + _.slideOffset;
  851. } else {
  852. targetLeft = ((slideIndex * verticalHeight) * -1) + verticalOffset;
  853. }
  854. if (_.options.variableWidth === true) {
  855. if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) {
  856. targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
  857. } else {
  858. targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow);
  859. }
  860. if (_.options.rtl === true) {
  861. if (targetSlide[0]) {
  862. targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1;
  863. } else {
  864. targetLeft = 0;
  865. }
  866. } else {
  867. targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
  868. }
  869. if (_.options.centerMode === true) {
  870. if (_.slideCount <= _.options.slidesToShow || _.options.infinite === false) {
  871. targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex);
  872. } else {
  873. targetSlide = _.$slideTrack.children('.slick-slide').eq(slideIndex + _.options.slidesToShow + 1);
  874. }
  875. if (_.options.rtl === true) {
  876. if (targetSlide[0]) {
  877. targetLeft = (_.$slideTrack.width() - targetSlide[0].offsetLeft - targetSlide.width()) * -1;
  878. } else {
  879. targetLeft = 0;
  880. }
  881. } else {
  882. targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0;
  883. }
  884. targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2;
  885. }
  886. }
  887. return targetLeft;
  888. };
  889. Slick.prototype.getOption = Slick.prototype.slickGetOption = function(option) {
  890. var _ = this;
  891. return _.options[option];
  892. };
  893. Slick.prototype.getNavigableIndexes = function() {
  894. var _ = this,
  895. breakPoint = 0,
  896. counter = 0,
  897. indexes = [],
  898. max;
  899. if (_.options.infinite === false) {
  900. max = _.slideCount;
  901. } else {
  902. breakPoint = _.options.slidesToScroll * -1;
  903. counter = _.options.slidesToScroll * -1;
  904. max = _.slideCount * 2;
  905. }
  906. while (breakPoint < max) {
  907. indexes.push(breakPoint);
  908. breakPoint = counter + _.options.slidesToScroll;
  909. counter += _.options.slidesToScroll <= _.options.slidesToShow ? _.options.slidesToScroll : _.options.slidesToShow;
  910. }
  911. return indexes;
  912. };
  913. Slick.prototype.getSlick = function() {
  914. return this;
  915. };
  916. Slick.prototype.getSlideCount = function() {
  917. var _ = this,
  918. slidesTraversed, swipedSlide, centerOffset;
  919. centerOffset = _.options.centerMode === true ? _.slideWidth * Math.floor(_.options.slidesToShow / 2) : 0;
  920. if (_.options.swipeToSlide === true) {
  921. _.$slideTrack.find('.slick-slide').each(function(index, slide) {
  922. if (slide.offsetLeft - centerOffset + ($(slide).outerWidth() / 2) > (_.swipeLeft * -1)) {
  923. swipedSlide = slide;
  924. return false;
  925. }
  926. });
  927. slidesTraversed = Math.abs($(swipedSlide).attr('data-slick-index') - _.currentSlide) || 1;
  928. return slidesTraversed;
  929. } else {
  930. return _.options.slidesToScroll;
  931. }
  932. };
  933. Slick.prototype.goTo = Slick.prototype.slickGoTo = function(slide, dontAnimate) {
  934. var _ = this;
  935. _.changeSlide({
  936. data: {
  937. message: 'index',
  938. index: parseInt(slide)
  939. }
  940. }, dontAnimate);
  941. };
  942. Slick.prototype.init = function(creation) {
  943. var _ = this;
  944. if (!$(_.$slider).hasClass('slick-initialized')) {
  945. $(_.$slider).addClass('slick-initialized');
  946. _.buildRows();
  947. _.buildOut();
  948. _.setProps();
  949. _.startLoad();
  950. _.loadSlider();
  951. _.initializeEvents();
  952. _.updateArrows();
  953. _.updateDots();
  954. _.checkResponsive(true);
  955. _.focusHandler();
  956. }
  957. if (creation) {
  958. _.$slider.trigger('init', [_]);
  959. }
  960. if (_.options.accessibility === true) {
  961. _.initADA();
  962. }
  963. if ( _.options.autoplay ) {
  964. _.paused = false;
  965. _.autoPlay();
  966. }
  967. };
  968. Slick.prototype.initADA = function() {
  969. var _ = this,
  970. numDotGroups = Math.ceil(_.slideCount / _.options.slidesToShow),
  971. tabControlIndexes = _.getNavigableIndexes().filter(function(val) {
  972. return (val >= 0) && (val < _.slideCount);
  973. });
  974. _.$slides.add(_.$slideTrack.find('.slick-cloned')).attr({
  975. 'aria-hidden': 'true',
  976. 'tabindex': '-1'
  977. }).find('a, input, button, select').attr({
  978. 'tabindex': '-1'
  979. });
  980. if (_.$dots !== null) {
  981. _.$slides.not(_.$slideTrack.find('.slick-cloned')).each(function(i) {
  982. var slideControlIndex = tabControlIndexes.indexOf(i);
  983. $(this).attr({
  984. 'role': 'tabpanel',
  985. 'id': 'slick-slide' + _.instanceUid + i,
  986. 'tabindex': -1
  987. });
  988. if (slideControlIndex !== -1) {
  989. var ariaButtonControl = 'slick-slide-control' + _.instanceUid + slideControlIndex
  990. if ($('#' + ariaButtonControl).length) {
  991. $(this).attr({
  992. 'aria-describedby': ariaButtonControl
  993. });
  994. }
  995. }
  996. });
  997. _.$dots.attr('role', 'tablist').find('li').each(function(i) {
  998. var mappedSlideIndex = tabControlIndexes[i];
  999. $(this).attr({
  1000. 'role': 'presentation'
  1001. });
  1002. $(this).find('button').first().attr({
  1003. 'role': 'tab',
  1004. 'id': 'slick-slide-control' + _.instanceUid + i,
  1005. 'aria-controls': 'slick-slide' + _.instanceUid + mappedSlideIndex,
  1006. 'aria-label': (i + 1) + ' of ' + numDotGroups,
  1007. 'aria-selected': null,
  1008. 'tabindex': '-1'
  1009. });
  1010. }).eq(_.currentSlide).find('button').attr({
  1011. 'aria-selected': 'true',
  1012. 'tabindex': '0'
  1013. }).end();
  1014. }
  1015. for (var i=_.currentSlide, max=i+_.options.slidesToShow; i < max; i++) {
  1016. if (_.options.focusOnChange) {
  1017. _.$slides.eq(i).attr({'tabindex': '0'});
  1018. } else {
  1019. _.$slides.eq(i).removeAttr('tabindex');
  1020. }
  1021. }
  1022. _.activateADA();
  1023. };
  1024. Slick.prototype.initArrowEvents = function() {
  1025. var _ = this;
  1026. if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
  1027. _.$prevArrow
  1028. .off('click.slick')
  1029. .on('click.slick', {
  1030. message: 'previous'
  1031. }, _.changeSlide);
  1032. _.$nextArrow
  1033. .off('click.slick')
  1034. .on('click.slick', {
  1035. message: 'next'
  1036. }, _.changeSlide);
  1037. if (_.options.accessibility === true) {
  1038. _.$prevArrow.on('keydown.slick', _.keyHandler);
  1039. _.$nextArrow.on('keydown.slick', _.keyHandler);
  1040. }
  1041. }
  1042. };
  1043. Slick.prototype.initDotEvents = function() {
  1044. var _ = this;
  1045. if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
  1046. $('li', _.$dots).on('click.slick', {
  1047. message: 'index'
  1048. }, _.changeSlide);
  1049. if (_.options.accessibility === true) {
  1050. _.$dots.on('keydown.slick', _.keyHandler);
  1051. }
  1052. }
  1053. if (_.options.dots === true && _.options.pauseOnDotsHover === true && _.slideCount > _.options.slidesToShow) {
  1054. $('li', _.$dots)
  1055. .on('mouseenter.slick', $.proxy(_.interrupt, _, true))
  1056. .on('mouseleave.slick', $.proxy(_.interrupt, _, false));
  1057. }
  1058. };
  1059. Slick.prototype.initSlideEvents = function() {
  1060. var _ = this;
  1061. if ( _.options.pauseOnHover ) {
  1062. _.$list.on('mouseenter.slick', $.proxy(_.interrupt, _, true));
  1063. _.$list.on('mouseleave.slick', $.proxy(_.interrupt, _, false));
  1064. }
  1065. };
  1066. Slick.prototype.initializeEvents = function() {
  1067. var _ = this;
  1068. _.initArrowEvents();
  1069. _.initDotEvents();
  1070. _.initSlideEvents();
  1071. _.$list.on('touchstart.slick mousedown.slick', {
  1072. action: 'start'
  1073. }, _.swipeHandler);
  1074. _.$list.on('touchmove.slick mousemove.slick', {
  1075. action: 'move'
  1076. }, _.swipeHandler);
  1077. _.$list.on('touchend.slick mouseup.slick', {
  1078. action: 'end'
  1079. }, _.swipeHandler);
  1080. _.$list.on('touchcancel.slick mouseleave.slick', {
  1081. action: 'end'
  1082. }, _.swipeHandler);
  1083. _.$list.on('click.slick', _.clickHandler);
  1084. $(document).on(_.visibilityChange, $.proxy(_.visibility, _));
  1085. if (_.options.accessibility === true) {
  1086. _.$list.on('keydown.slick', _.keyHandler);
  1087. }
  1088. if (_.options.focusOnSelect === true) {
  1089. $(_.$slideTrack).children().on('click.slick', _.selectHandler);
  1090. }
  1091. $(window).on('orientationchange.slick.slick-' + _.instanceUid, $.proxy(_.orientationChange, _));
  1092. $(window).on('resize.slick.slick-' + _.instanceUid, $.proxy(_.resize, _));
  1093. $('[draggable!=true]', _.$slideTrack).on('dragstart', _.preventDefault);
  1094. $(window).on('load.slick.slick-' + _.instanceUid, _.setPosition);
  1095. $(_.setPosition);
  1096. };
  1097. Slick.prototype.initUI = function() {
  1098. var _ = this;
  1099. if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
  1100. _.$prevArrow.show();
  1101. _.$nextArrow.show();
  1102. }
  1103. if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
  1104. _.$dots.show();
  1105. }
  1106. };
  1107. Slick.prototype.keyHandler = function(event) {
  1108. var _ = this;
  1109. //Dont slide if the cursor is inside the form fields and arrow keys are pressed
  1110. if(!event.target.tagName.match('TEXTAREA|INPUT|SELECT')) {
  1111. if (event.keyCode === 37 && _.options.accessibility === true) {
  1112. _.changeSlide({
  1113. data: {
  1114. message: _.options.rtl === true ? 'next' : 'previous'
  1115. }
  1116. });
  1117. } else if (event.keyCode === 39 && _.options.accessibility === true) {
  1118. _.changeSlide({
  1119. data: {
  1120. message: _.options.rtl === true ? 'previous' : 'next'
  1121. }
  1122. });
  1123. }
  1124. }
  1125. };
  1126. Slick.prototype.lazyLoad = function() {
  1127. var _ = this,
  1128. loadRange, cloneRange, rangeStart, rangeEnd;
  1129. function loadImages(imagesScope) {
  1130. $('img[data-lazy]', imagesScope).each(function() {
  1131. var image = $(this),
  1132. imageSource = $(this).attr('data-lazy'),
  1133. imageSrcSet = $(this).attr('data-srcset'),
  1134. imageSizes = $(this).attr('data-sizes') || _.$slider.attr('data-sizes'),
  1135. imageToLoad = document.createElement('img');
  1136. imageToLoad.onload = function() {
  1137. image
  1138. .animate({ opacity: 0 }, 100, function() {
  1139. if (imageSrcSet) {
  1140. image
  1141. .attr('srcset', imageSrcSet );
  1142. if (imageSizes) {
  1143. image
  1144. .attr('sizes', imageSizes );
  1145. }
  1146. }
  1147. image
  1148. .attr('src', imageSource)
  1149. .animate({ opacity: 1 }, 200, function() {
  1150. image
  1151. .removeAttr('data-lazy data-srcset data-sizes')
  1152. .removeClass('slick-loading');
  1153. });
  1154. _.$slider.trigger('lazyLoaded', [_, image, imageSource]);
  1155. });
  1156. };
  1157. imageToLoad.onerror = function() {
  1158. image
  1159. .removeAttr( 'data-lazy' )
  1160. .removeClass( 'slick-loading' )
  1161. .addClass( 'slick-lazyload-error' );
  1162. _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]);
  1163. };
  1164. imageToLoad.src = imageSource;
  1165. });
  1166. }
  1167. if (_.options.centerMode === true) {
  1168. if (_.options.infinite === true) {
  1169. rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1);
  1170. rangeEnd = rangeStart + _.options.slidesToShow + 2;
  1171. } else {
  1172. rangeStart = Math.max(0, _.currentSlide - (_.options.slidesToShow / 2 + 1));
  1173. rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide;
  1174. }
  1175. } else {
  1176. rangeStart = _.options.infinite ? _.options.slidesToShow + _.currentSlide : _.currentSlide;
  1177. rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow);
  1178. if (_.options.fade === true) {
  1179. if (rangeStart > 0) rangeStart--;
  1180. if (rangeEnd <= _.slideCount) rangeEnd++;
  1181. }
  1182. }
  1183. loadRange = _.$slider.find('.slick-slide').slice(rangeStart, rangeEnd);
  1184. if (_.options.lazyLoad === 'anticipated') {
  1185. var prevSlide = rangeStart - 1,
  1186. nextSlide = rangeEnd,
  1187. $slides = _.$slider.find('.slick-slide');
  1188. for (var i = 0; i < _.options.slidesToScroll; i++) {
  1189. if (prevSlide < 0) prevSlide = _.slideCount - 1;
  1190. loadRange = loadRange.add($slides.eq(prevSlide));
  1191. loadRange = loadRange.add($slides.eq(nextSlide));
  1192. prevSlide--;
  1193. nextSlide++;
  1194. }
  1195. }
  1196. loadImages(loadRange);
  1197. if (_.slideCount <= _.options.slidesToShow) {
  1198. cloneRange = _.$slider.find('.slick-slide');
  1199. loadImages(cloneRange);
  1200. } else
  1201. if (_.currentSlide >= _.slideCount - _.options.slidesToShow) {
  1202. cloneRange = _.$slider.find('.slick-cloned').slice(0, _.options.slidesToShow);
  1203. loadImages(cloneRange);
  1204. } else if (_.currentSlide === 0) {
  1205. cloneRange = _.$slider.find('.slick-cloned').slice(_.options.slidesToShow * -1);
  1206. loadImages(cloneRange);
  1207. }
  1208. };
  1209. Slick.prototype.loadSlider = function() {
  1210. var _ = this;
  1211. _.setPosition();
  1212. _.$slideTrack.css({
  1213. opacity: 1
  1214. });
  1215. _.$slider.removeClass('slick-loading');
  1216. _.initUI();
  1217. if (_.options.lazyLoad === 'progressive') {
  1218. _.progressiveLazyLoad();
  1219. }
  1220. };
  1221. Slick.prototype.next = Slick.prototype.slickNext = function() {
  1222. var _ = this;
  1223. _.changeSlide({
  1224. data: {
  1225. message: 'next'
  1226. }
  1227. });
  1228. };
  1229. Slick.prototype.orientationChange = function() {
  1230. var _ = this;
  1231. _.checkResponsive();
  1232. _.setPosition();
  1233. };
  1234. Slick.prototype.pause = Slick.prototype.slickPause = function() {
  1235. var _ = this;
  1236. _.autoPlayClear();
  1237. _.paused = true;
  1238. };
  1239. Slick.prototype.play = Slick.prototype.slickPlay = function() {
  1240. var _ = this;
  1241. _.autoPlay();
  1242. _.options.autoplay = true;
  1243. _.paused = false;
  1244. _.focussed = false;
  1245. _.interrupted = false;
  1246. };
  1247. Slick.prototype.postSlide = function(index) {
  1248. var _ = this;
  1249. if( !_.unslicked ) {
  1250. _.$slider.trigger('afterChange', [_, index]);
  1251. _.animating = false;
  1252. if (_.slideCount > _.options.slidesToShow) {
  1253. _.setPosition();
  1254. }
  1255. _.swipeLeft = null;
  1256. if ( _.options.autoplay ) {
  1257. _.autoPlay();
  1258. }
  1259. if (_.options.accessibility === true) {
  1260. _.initADA();
  1261. if (_.options.focusOnChange) {
  1262. var $currentSlide = $(_.$slides.get(_.currentSlide));
  1263. $currentSlide.attr('tabindex', 0).focus();
  1264. }
  1265. }
  1266. }
  1267. };
  1268. Slick.prototype.prev = Slick.prototype.slickPrev = function() {
  1269. var _ = this;
  1270. _.changeSlide({
  1271. data: {
  1272. message: 'previous'
  1273. }
  1274. });
  1275. };
  1276. Slick.prototype.preventDefault = function(event) {
  1277. event.preventDefault();
  1278. };
  1279. Slick.prototype.progressiveLazyLoad = function( tryCount ) {
  1280. tryCount = tryCount || 1;
  1281. var _ = this,
  1282. $imgsToLoad = $( 'img[data-lazy]', _.$slider ),
  1283. image,
  1284. imageSource,
  1285. imageSrcSet,
  1286. imageSizes,
  1287. imageToLoad;
  1288. if ( $imgsToLoad.length ) {
  1289. image = $imgsToLoad.first();
  1290. imageSource = image.attr('data-lazy');
  1291. imageSrcSet = image.attr('data-srcset');
  1292. imageSizes = image.attr('data-sizes') || _.$slider.attr('data-sizes');
  1293. imageToLoad = document.createElement('img');
  1294. imageToLoad.onload = function() {
  1295. if (imageSrcSet) {
  1296. image
  1297. .attr('srcset', imageSrcSet );
  1298. if (imageSizes) {
  1299. image
  1300. .attr('sizes', imageSizes );
  1301. }
  1302. }
  1303. image
  1304. .attr( 'src', imageSource )
  1305. .removeAttr('data-lazy data-srcset data-sizes')
  1306. .removeClass('slick-loading');
  1307. if ( _.options.adaptiveHeight === true ) {
  1308. _.setPosition();
  1309. }
  1310. _.$slider.trigger('lazyLoaded', [ _, image, imageSource ]);
  1311. _.progressiveLazyLoad();
  1312. };
  1313. imageToLoad.onerror = function() {
  1314. if ( tryCount < 3 ) {
  1315. /**
  1316. * try to load the image 3 times,
  1317. * leave a slight delay so we don't get
  1318. * servers blocking the request.
  1319. */
  1320. setTimeout( function() {
  1321. _.progressiveLazyLoad( tryCount + 1 );
  1322. }, 500 );
  1323. } else {
  1324. image
  1325. .removeAttr( 'data-lazy' )
  1326. .removeClass( 'slick-loading' )
  1327. .addClass( 'slick-lazyload-error' );
  1328. _.$slider.trigger('lazyLoadError', [ _, image, imageSource ]);
  1329. _.progressiveLazyLoad();
  1330. }
  1331. };
  1332. imageToLoad.src = imageSource;
  1333. } else {
  1334. _.$slider.trigger('allImagesLoaded', [ _ ]);
  1335. }
  1336. };
  1337. Slick.prototype.refresh = function( initializing ) {
  1338. var _ = this, currentSlide, lastVisibleIndex;
  1339. lastVisibleIndex = _.slideCount - _.options.slidesToShow;
  1340. // in non-infinite sliders, we don't want to go past the
  1341. // last visible index.
  1342. if( !_.options.infinite && ( _.currentSlide > lastVisibleIndex )) {
  1343. _.currentSlide = lastVisibleIndex;
  1344. }
  1345. // if less slides than to show, go to start.
  1346. if ( _.slideCount <= _.options.slidesToShow ) {
  1347. _.currentSlide = 0;
  1348. }
  1349. currentSlide = _.currentSlide;
  1350. _.destroy(true);
  1351. $.extend(_, _.initials, { currentSlide: currentSlide });
  1352. _.init();
  1353. if( !initializing ) {
  1354. _.changeSlide({
  1355. data: {
  1356. message: 'index',
  1357. index: currentSlide
  1358. }
  1359. }, false);
  1360. }
  1361. };
  1362. Slick.prototype.registerBreakpoints = function() {
  1363. var _ = this, breakpoint, currentBreakpoint, l,
  1364. responsiveSettings = _.options.responsive || null;
  1365. if ( $.type(responsiveSettings) === 'array' && responsiveSettings.length ) {
  1366. _.respondTo = _.options.respondTo || 'window';
  1367. for ( breakpoint in responsiveSettings ) {
  1368. l = _.breakpoints.length-1;
  1369. if (responsiveSettings.hasOwnProperty(breakpoint)) {
  1370. currentBreakpoint = responsiveSettings[breakpoint].breakpoint;
  1371. // loop through the breakpoints and cut out any existing
  1372. // ones with the same breakpoint number, we don't want dupes.
  1373. while( l >= 0 ) {
  1374. if( _.breakpoints[l] && _.breakpoints[l] === currentBreakpoint ) {
  1375. _.breakpoints.splice(l,1);
  1376. }
  1377. l--;
  1378. }
  1379. _.breakpoints.push(currentBreakpoint);
  1380. _.breakpointSettings[currentBreakpoint] = responsiveSettings[breakpoint].settings;
  1381. }
  1382. }
  1383. _.breakpoints.sort(function(a, b) {
  1384. return ( _.options.mobileFirst ) ? a-b : b-a;
  1385. });
  1386. }
  1387. };
  1388. Slick.prototype.reinit = function() {
  1389. var _ = this;
  1390. _.$slides =
  1391. _.$slideTrack
  1392. .children(_.options.slide)
  1393. .addClass('slick-slide');
  1394. _.slideCount = _.$slides.length;
  1395. if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) {
  1396. _.currentSlide = _.currentSlide - _.options.slidesToScroll;
  1397. }
  1398. if (_.slideCount <= _.options.slidesToShow) {
  1399. _.currentSlide = 0;
  1400. }
  1401. _.registerBreakpoints();
  1402. _.setProps();
  1403. _.setupInfinite();
  1404. _.buildArrows();
  1405. _.updateArrows();
  1406. _.initArrowEvents();
  1407. _.buildDots();
  1408. _.updateDots();
  1409. _.initDotEvents();
  1410. _.cleanUpSlideEvents();
  1411. _.initSlideEvents();
  1412. _.checkResponsive(false, true);
  1413. if (_.options.focusOnSelect === true) {
  1414. $(_.$slideTrack).children().on('click.slick', _.selectHandler);
  1415. }
  1416. _.setSlideClasses(typeof _.currentSlide === 'number' ? _.currentSlide : 0);
  1417. _.setPosition();
  1418. _.focusHandler();
  1419. _.paused = !_.options.autoplay;
  1420. _.autoPlay();
  1421. _.$slider.trigger('reInit', [_]);
  1422. };
  1423. Slick.prototype.resize = function() {
  1424. var _ = this;
  1425. if ($(window).width() !== _.windowWidth) {
  1426. clearTimeout(_.windowDelay);
  1427. _.windowDelay = window.setTimeout(function() {
  1428. _.windowWidth = $(window).width();
  1429. _.checkResponsive();
  1430. if( !_.unslicked ) { _.setPosition(); }
  1431. }, 50);
  1432. }
  1433. };
  1434. Slick.prototype.removeSlide = Slick.prototype.slickRemove = function(index, removeBefore, removeAll) {
  1435. var _ = this;
  1436. if (typeof(index) === 'boolean') {
  1437. removeBefore = index;
  1438. index = removeBefore === true ? 0 : _.slideCount - 1;
  1439. } else {
  1440. index = removeBefore === true ? --index : index;
  1441. }
  1442. if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) {
  1443. return false;
  1444. }
  1445. _.unload();
  1446. if (removeAll === true) {
  1447. _.$slideTrack.children().remove();
  1448. } else {
  1449. _.$slideTrack.children(this.options.slide).eq(index).remove();
  1450. }
  1451. _.$slides = _.$slideTrack.children(this.options.slide);
  1452. _.$slideTrack.children(this.options.slide).detach();
  1453. _.$slideTrack.append(_.$slides);
  1454. _.$slidesCache = _.$slides;
  1455. _.reinit();
  1456. };
  1457. Slick.prototype.setCSS = function(position) {
  1458. var _ = this,
  1459. positionProps = {},
  1460. x, y;
  1461. if (_.options.rtl === true) {
  1462. position = -position;
  1463. }
  1464. x = _.positionProp == 'left' ? Math.ceil(position) + 'px' : '0px';
  1465. y = _.positionProp == 'top' ? Math.ceil(position) + 'px' : '0px';
  1466. positionProps[_.positionProp] = position;
  1467. if (_.transformsEnabled === false) {
  1468. _.$slideTrack.css(positionProps);
  1469. } else {
  1470. positionProps = {};
  1471. if (_.cssTransitions === false) {
  1472. positionProps[_.animType] = 'translate(' + x + ', ' + y + ')';
  1473. _.$slideTrack.css(positionProps);
  1474. } else {
  1475. positionProps[_.animType] = 'translate3d(' + x + ', ' + y + ', 0px)';
  1476. _.$slideTrack.css(positionProps);
  1477. }
  1478. }
  1479. };
  1480. Slick.prototype.setDimensions = function() {
  1481. var _ = this;
  1482. if (_.options.vertical === false) {
  1483. if (_.options.centerMode === true) {
  1484. _.$list.css({
  1485. padding: ('0px ' + _.options.centerPadding)
  1486. });
  1487. }
  1488. } else {
  1489. _.$list.height(_.$slides.first().outerHeight(true) * _.options.slidesToShow);
  1490. if (_.options.centerMode === true) {
  1491. _.$list.css({
  1492. padding: (_.options.centerPadding + ' 0px')
  1493. });
  1494. }
  1495. }
  1496. _.listWidth = _.$list.width();
  1497. _.listHeight = _.$list.height();
  1498. if (_.options.vertical === false && _.options.variableWidth === false) {
  1499. _.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow);
  1500. _.$slideTrack.width(Math.ceil((_.slideWidth * _.$slideTrack.children('.slick-slide').length)));
  1501. } else if (_.options.variableWidth === true) {
  1502. _.$slideTrack.width(5000 * _.slideCount);
  1503. } else {
  1504. _.slideWidth = Math.ceil(_.listWidth);
  1505. _.$slideTrack.height(Math.ceil((_.$slides.first().outerHeight(true) * _.$slideTrack.children('.slick-slide').length)));
  1506. }
  1507. var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width();
  1508. if (_.options.variableWidth === false) _.$slideTrack.children('.slick-slide').width(_.slideWidth - offset);
  1509. };
  1510. Slick.prototype.setFade = function() {
  1511. var _ = this,
  1512. targetLeft;
  1513. _.$slides.each(function(index, element) {
  1514. targetLeft = (_.slideWidth * index) * -1;
  1515. if (_.options.rtl === true) {
  1516. $(element).css({
  1517. position: 'relative',
  1518. right: targetLeft,
  1519. top: 0,
  1520. zIndex: _.options.zIndex - 2,
  1521. opacity: 0
  1522. });
  1523. } else {
  1524. $(element).css({
  1525. position: 'relative',
  1526. left: targetLeft,
  1527. top: 0,
  1528. zIndex: _.options.zIndex - 2,
  1529. opacity: 0
  1530. });
  1531. }
  1532. });
  1533. _.$slides.eq(_.currentSlide).css({
  1534. zIndex: _.options.zIndex - 1,
  1535. opacity: 1
  1536. });
  1537. };
  1538. Slick.prototype.setHeight = function() {
  1539. var _ = this;
  1540. if (_.options.slidesToShow === 1 && _.options.adaptiveHeight === true && _.options.vertical === false) {
  1541. var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true);
  1542. _.$list.css('height', targetHeight);
  1543. }
  1544. };
  1545. Slick.prototype.setOption =
  1546. Slick.prototype.slickSetOption = function() {
  1547. /**
  1548. * accepts arguments in format of:
  1549. *
  1550. * - for changing a single option's value:
  1551. * .slick("setOption", option, value, refresh )
  1552. *
  1553. * - for changing a set of responsive options:
  1554. * .slick("setOption", 'responsive', [{}, ...], refresh )
  1555. *
  1556. * - for updating multiple values at once (not responsive)
  1557. * .slick("setOption", { 'option': value, ... }, refresh )
  1558. */
  1559. var _ = this, l, item, option, value, refresh = false, type;
  1560. if( $.type( arguments[0] ) === 'object' ) {
  1561. option = arguments[0];
  1562. refresh = arguments[1];
  1563. type = 'multiple';
  1564. } else if ( $.type( arguments[0] ) === 'string' ) {
  1565. option = arguments[0];
  1566. value = arguments[1];
  1567. refresh = arguments[2];
  1568. if ( arguments[0] === 'responsive' && $.type( arguments[1] ) === 'array' ) {
  1569. type = 'responsive';
  1570. } else if ( typeof arguments[1] !== 'undefined' ) {
  1571. type = 'single';
  1572. }
  1573. }
  1574. if ( type === 'single' ) {
  1575. _.options[option] = value;
  1576. } else if ( type === 'multiple' ) {
  1577. $.each( option , function( opt, val ) {
  1578. _.options[opt] = val;
  1579. });
  1580. } else if ( type === 'responsive' ) {
  1581. for ( item in value ) {
  1582. if( $.type( _.options.responsive ) !== 'array' ) {
  1583. _.options.responsive = [ value[item] ];
  1584. } else {
  1585. l = _.options.responsive.length-1;
  1586. // loop through the responsive object and splice out duplicates.
  1587. while( l >= 0 ) {
  1588. if( _.options.responsive[l].breakpoint === value[item].breakpoint ) {
  1589. _.options.responsive.splice(l,1);
  1590. }
  1591. l--;
  1592. }
  1593. _.options.responsive.push( value[item] );
  1594. }
  1595. }
  1596. }
  1597. if ( refresh ) {
  1598. _.unload();
  1599. _.reinit();
  1600. }
  1601. };
  1602. Slick.prototype.setPosition = function() {
  1603. var _ = this;
  1604. _.setDimensions();
  1605. _.setHeight();
  1606. if (_.options.fade === false) {
  1607. _.setCSS(_.getLeft(_.currentSlide));
  1608. } else {
  1609. _.setFade();
  1610. }
  1611. _.$slider.trigger('setPosition', [_]);
  1612. };
  1613. Slick.prototype.setProps = function() {
  1614. var _ = this,
  1615. bodyStyle = document.body.style;
  1616. _.positionProp = _.options.vertical === true ? 'top' : 'left';
  1617. if (_.positionProp === 'top') {
  1618. _.$slider.addClass('slick-vertical');
  1619. } else {
  1620. _.$slider.removeClass('slick-vertical');
  1621. }
  1622. if (bodyStyle.WebkitTransition !== undefined ||
  1623. bodyStyle.MozTransition !== undefined ||
  1624. bodyStyle.msTransition !== undefined) {
  1625. if (_.options.useCSS === true) {
  1626. _.cssTransitions = true;
  1627. }
  1628. }
  1629. if ( _.options.fade ) {
  1630. if ( typeof _.options.zIndex === 'number' ) {
  1631. if( _.options.zIndex < 3 ) {
  1632. _.options.zIndex = 3;
  1633. }
  1634. } else {
  1635. _.options.zIndex = _.defaults.zIndex;
  1636. }
  1637. }
  1638. if (bodyStyle.OTransform !== undefined) {
  1639. _.animType = 'OTransform';
  1640. _.transformType = '-o-transform';
  1641. _.transitionType = 'OTransition';
  1642. if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
  1643. }
  1644. if (bodyStyle.MozTransform !== undefined) {
  1645. _.animType = 'MozTransform';
  1646. _.transformType = '-moz-transform';
  1647. _.transitionType = 'MozTransition';
  1648. if (bodyStyle.perspectiveProperty === undefined && bodyStyle.MozPerspective === undefined) _.animType = false;
  1649. }
  1650. if (bodyStyle.webkitTransform !== undefined) {
  1651. _.animType = 'webkitTransform';
  1652. _.transformType = '-webkit-transform';
  1653. _.transitionType = 'webkitTransition';
  1654. if (bodyStyle.perspectiveProperty === undefined && bodyStyle.webkitPerspective === undefined) _.animType = false;
  1655. }
  1656. if (bodyStyle.msTransform !== undefined) {
  1657. _.animType = 'msTransform';
  1658. _.transformType = '-ms-transform';
  1659. _.transitionType = 'msTransition';
  1660. if (bodyStyle.msTransform === undefined) _.animType = false;
  1661. }
  1662. if (bodyStyle.transform !== undefined && _.animType !== false) {
  1663. _.animType = 'transform';
  1664. _.transformType = 'transform';
  1665. _.transitionType = 'transition';
  1666. }
  1667. _.transformsEnabled = _.options.useTransform && (_.animType !== null && _.animType !== false);
  1668. };
  1669. Slick.prototype.setSlideClasses = function(index) {
  1670. var _ = this,
  1671. centerOffset, allSlides, indexOffset, remainder;
  1672. allSlides = _.$slider
  1673. .find('.slick-slide')
  1674. .removeClass('slick-active slick-center slick-current')
  1675. .attr('aria-hidden', 'true');
  1676. _.$slides
  1677. .eq(index)
  1678. .addClass('slick-current');
  1679. if (_.options.centerMode === true) {
  1680. var evenCoef = _.options.slidesToShow % 2 === 0 ? 1 : 0;
  1681. centerOffset = Math.floor(_.options.slidesToShow / 2);
  1682. if (_.options.infinite === true) {
  1683. if (index >= centerOffset && index <= (_.slideCount - 1) - centerOffset) {
  1684. _.$slides
  1685. .slice(index - centerOffset + evenCoef, index + centerOffset + 1)
  1686. .addClass('slick-active')
  1687. .attr('aria-hidden', 'false');
  1688. } else {
  1689. indexOffset = _.options.slidesToShow + index;
  1690. allSlides
  1691. .slice(indexOffset - centerOffset + 1 + evenCoef, indexOffset + centerOffset + 2)
  1692. .addClass('slick-active')
  1693. .attr('aria-hidden', 'false');
  1694. }
  1695. if (index === 0) {
  1696. allSlides
  1697. .eq(allSlides.length - 1 - _.options.slidesToShow)
  1698. .addClass('slick-center');
  1699. } else if (index === _.slideCount - 1) {
  1700. allSlides
  1701. .eq(_.options.slidesToShow)
  1702. .addClass('slick-center');
  1703. }
  1704. }
  1705. _.$slides
  1706. .eq(index)
  1707. .addClass('slick-center');
  1708. } else {
  1709. if (index >= 0 && index <= (_.slideCount - _.options.slidesToShow)) {
  1710. _.$slides
  1711. .slice(index, index + _.options.slidesToShow)
  1712. .addClass('slick-active')
  1713. .attr('aria-hidden', 'false');
  1714. } else if (allSlides.length <= _.options.slidesToShow) {
  1715. allSlides
  1716. .addClass('slick-active')
  1717. .attr('aria-hidden', 'false');
  1718. } else {
  1719. remainder = _.slideCount % _.options.slidesToShow;
  1720. indexOffset = _.options.infinite === true ? _.options.slidesToShow + index : index;
  1721. if (_.options.slidesToShow == _.options.slidesToScroll && (_.slideCount - index) < _.options.slidesToShow) {
  1722. allSlides
  1723. .slice(indexOffset - (_.options.slidesToShow - remainder), indexOffset + remainder)
  1724. .addClass('slick-active')
  1725. .attr('aria-hidden', 'false');
  1726. } else {
  1727. allSlides
  1728. .slice(indexOffset, indexOffset + _.options.slidesToShow)
  1729. .addClass('slick-active')
  1730. .attr('aria-hidden', 'false');
  1731. }
  1732. }
  1733. }
  1734. if (_.options.lazyLoad === 'ondemand' || _.options.lazyLoad === 'anticipated') {
  1735. _.lazyLoad();
  1736. }
  1737. };
  1738. Slick.prototype.setupInfinite = function() {
  1739. var _ = this,
  1740. i, slideIndex, infiniteCount;
  1741. if (_.options.fade === true) {
  1742. _.options.centerMode = false;
  1743. }
  1744. if (_.options.infinite === true && _.options.fade === false) {
  1745. slideIndex = null;
  1746. if (_.slideCount > _.options.slidesToShow) {
  1747. if (_.options.centerMode === true) {
  1748. infiniteCount = _.options.slidesToShow + 1;
  1749. } else {
  1750. infiniteCount = _.options.slidesToShow;
  1751. }
  1752. for (i = _.slideCount; i > (_.slideCount -
  1753. infiniteCount); i -= 1) {
  1754. slideIndex = i - 1;
  1755. $(_.$slides[slideIndex]).clone(true).attr('id', '')
  1756. .attr('data-slick-index', slideIndex - _.slideCount)
  1757. .prependTo(_.$slideTrack).addClass('slick-cloned');
  1758. }
  1759. for (i = 0; i < infiniteCount + _.slideCount; i += 1) {
  1760. slideIndex = i;
  1761. $(_.$slides[slideIndex]).clone(true).attr('id', '')
  1762. .attr('data-slick-index', slideIndex + _.slideCount)
  1763. .appendTo(_.$slideTrack).addClass('slick-cloned');
  1764. }
  1765. _.$slideTrack.find('.slick-cloned').find('[id]').each(function() {
  1766. $(this).attr('id', '');
  1767. });
  1768. }
  1769. }
  1770. };
  1771. Slick.prototype.interrupt = function( toggle ) {
  1772. var _ = this;
  1773. if( !toggle ) {
  1774. _.autoPlay();
  1775. }
  1776. _.interrupted = toggle;
  1777. };
  1778. Slick.prototype.selectHandler = function(event) {
  1779. var _ = this;
  1780. var targetElement =
  1781. $(event.target).is('.slick-slide') ?
  1782. $(event.target) :
  1783. $(event.target).parents('.slick-slide');
  1784. var index = parseInt(targetElement.attr('data-slick-index'));
  1785. if (!index) index = 0;
  1786. if (_.slideCount <= _.options.slidesToShow) {
  1787. _.slideHandler(index, false, true);
  1788. return;
  1789. }
  1790. _.slideHandler(index);
  1791. };
  1792. Slick.prototype.slideHandler = function(index, sync, dontAnimate) {
  1793. var targetSlide, animSlide, oldSlide, slideLeft, targetLeft = null,
  1794. _ = this, navTarget;
  1795. sync = sync || false;
  1796. if (_.animating === true && _.options.waitForAnimate === true) {
  1797. return;
  1798. }
  1799. if (_.options.fade === true && _.currentSlide === index) {
  1800. return;
  1801. }
  1802. if (sync === false) {
  1803. _.asNavFor(index);
  1804. }
  1805. targetSlide = index;
  1806. targetLeft = _.getLeft(targetSlide);
  1807. slideLeft = _.getLeft(_.currentSlide);
  1808. _.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft;
  1809. if (_.options.infinite === false && _.options.centerMode === false && (index < 0 || index > _.getDotCount() * _.options.slidesToScroll)) {
  1810. if (_.options.fade === false) {
  1811. targetSlide = _.currentSlide;
  1812. if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) {
  1813. _.animateSlide(slideLeft, function() {
  1814. _.postSlide(targetSlide);
  1815. });
  1816. } else {
  1817. _.postSlide(targetSlide);
  1818. }
  1819. }
  1820. return;
  1821. } else if (_.options.infinite === false && _.options.centerMode === true && (index < 0 || index > (_.slideCount - _.options.slidesToScroll))) {
  1822. if (_.options.fade === false) {
  1823. targetSlide = _.currentSlide;
  1824. if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) {
  1825. _.animateSlide(slideLeft, function() {
  1826. _.postSlide(targetSlide);
  1827. });
  1828. } else {
  1829. _.postSlide(targetSlide);
  1830. }
  1831. }
  1832. return;
  1833. }
  1834. if ( _.options.autoplay ) {
  1835. clearInterval(_.autoPlayTimer);
  1836. }
  1837. if (targetSlide < 0) {
  1838. if (_.slideCount % _.options.slidesToScroll !== 0) {
  1839. animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll);
  1840. } else {
  1841. animSlide = _.slideCount + targetSlide;
  1842. }
  1843. } else if (targetSlide >= _.slideCount) {
  1844. if (_.slideCount % _.options.slidesToScroll !== 0) {
  1845. animSlide = 0;
  1846. } else {
  1847. animSlide = targetSlide - _.slideCount;
  1848. }
  1849. } else {
  1850. animSlide = targetSlide;
  1851. }
  1852. _.animating = true;
  1853. _.$slider.trigger('beforeChange', [_, _.currentSlide, animSlide]);
  1854. oldSlide = _.currentSlide;
  1855. _.currentSlide = animSlide;
  1856. _.setSlideClasses(_.currentSlide);
  1857. if ( _.options.asNavFor ) {
  1858. navTarget = _.getNavTarget();
  1859. navTarget = navTarget.slick('getSlick');
  1860. if ( navTarget.slideCount <= navTarget.options.slidesToShow ) {
  1861. navTarget.setSlideClasses(_.currentSlide);
  1862. }
  1863. }
  1864. _.updateDots();
  1865. _.updateArrows();
  1866. if (_.options.fade === true) {
  1867. if (dontAnimate !== true) {
  1868. _.fadeSlideOut(oldSlide);
  1869. _.fadeSlide(animSlide, function() {
  1870. _.postSlide(animSlide);
  1871. });
  1872. } else {
  1873. _.postSlide(animSlide);
  1874. }
  1875. _.animateHeight();
  1876. return;
  1877. }
  1878. if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) {
  1879. _.animateSlide(targetLeft, function() {
  1880. _.postSlide(animSlide);
  1881. });
  1882. } else {
  1883. _.postSlide(animSlide);
  1884. }
  1885. };
  1886. Slick.prototype.startLoad = function() {
  1887. var _ = this;
  1888. if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) {
  1889. _.$prevArrow.hide();
  1890. _.$nextArrow.hide();
  1891. }
  1892. if (_.options.dots === true && _.slideCount > _.options.slidesToShow) {
  1893. _.$dots.hide();
  1894. }
  1895. _.$slider.addClass('slick-loading');
  1896. };
  1897. Slick.prototype.swipeDirection = function() {
  1898. var xDist, yDist, r, swipeAngle, _ = this;
  1899. xDist = _.touchObject.startX - _.touchObject.curX;
  1900. yDist = _.touchObject.startY - _.touchObject.curY;
  1901. r = Math.atan2(yDist, xDist);
  1902. swipeAngle = Math.round(r * 180 / Math.PI);
  1903. if (swipeAngle < 0) {
  1904. swipeAngle = 360 - Math.abs(swipeAngle);
  1905. }
  1906. if ((swipeAngle <= 45) && (swipeAngle >= 0)) {
  1907. return (_.options.rtl === false ? 'left' : 'right');
  1908. }
  1909. if ((swipeAngle <= 360) && (swipeAngle >= 315)) {
  1910. return (_.options.rtl === false ? 'left' : 'right');
  1911. }
  1912. if ((swipeAngle >= 135) && (swipeAngle <= 225)) {
  1913. return (_.options.rtl === false ? 'right' : 'left');
  1914. }
  1915. if (_.options.verticalSwiping === true) {
  1916. if ((swipeAngle >= 35) && (swipeAngle <= 135)) {
  1917. return 'down';
  1918. } else {
  1919. return 'up';
  1920. }
  1921. }
  1922. return 'vertical';
  1923. };
  1924. Slick.prototype.swipeEnd = function(event) {
  1925. var _ = this,
  1926. slideCount,
  1927. direction;
  1928. _.dragging = false;
  1929. _.swiping = false;
  1930. if (_.scrolling) {
  1931. _.scrolling = false;
  1932. return false;
  1933. }
  1934. _.interrupted = false;
  1935. _.shouldClick = ( _.touchObject.swipeLength > 10 ) ? false : true;
  1936. if ( _.touchObject.curX === undefined ) {
  1937. return false;
  1938. }
  1939. if ( _.touchObject.edgeHit === true ) {
  1940. _.$slider.trigger('edge', [_, _.swipeDirection() ]);
  1941. }
  1942. if ( _.touchObject.swipeLength >= _.touchObject.minSwipe ) {
  1943. direction = _.swipeDirection();
  1944. switch ( direction ) {
  1945. case 'left':
  1946. case 'down':
  1947. slideCount =
  1948. _.options.swipeToSlide ?
  1949. _.checkNavigable( _.currentSlide + _.getSlideCount() ) :
  1950. _.currentSlide + _.getSlideCount();
  1951. _.currentDirection = 0;
  1952. break;
  1953. case 'right':
  1954. case 'up':
  1955. slideCount =
  1956. _.options.swipeToSlide ?
  1957. _.checkNavigable( _.currentSlide - _.getSlideCount() ) :
  1958. _.currentSlide - _.getSlideCount();
  1959. _.currentDirection = 1;
  1960. break;
  1961. default:
  1962. }
  1963. if( direction != 'vertical' ) {
  1964. _.slideHandler( slideCount );
  1965. _.touchObject = {};
  1966. _.$slider.trigger('swipe', [_, direction ]);
  1967. }
  1968. } else {
  1969. if ( _.touchObject.startX !== _.touchObject.curX ) {
  1970. _.slideHandler( _.currentSlide );
  1971. _.touchObject = {};
  1972. }
  1973. }
  1974. };
  1975. Slick.prototype.swipeHandler = function(event) {
  1976. var _ = this;
  1977. if ((_.options.swipe === false) || ('ontouchend' in document && _.options.swipe === false)) {
  1978. return;
  1979. } else if (_.options.draggable === false && event.type.indexOf('mouse') !== -1) {
  1980. return;
  1981. }
  1982. _.touchObject.fingerCount = event.originalEvent && event.originalEvent.touches !== undefined ?
  1983. event.originalEvent.touches.length : 1;
  1984. _.touchObject.minSwipe = _.listWidth / _.options
  1985. .touchThreshold;
  1986. if (_.options.verticalSwiping === true) {
  1987. _.touchObject.minSwipe = _.listHeight / _.options
  1988. .touchThreshold;
  1989. }
  1990. switch (event.data.action) {
  1991. case 'start':
  1992. _.swipeStart(event);
  1993. break;
  1994. case 'move':
  1995. _.swipeMove(event);
  1996. break;
  1997. case 'end':
  1998. _.swipeEnd(event);
  1999. break;
  2000. }
  2001. };
  2002. Slick.prototype.swipeMove = function(event) {
  2003. var _ = this,
  2004. edgeWasHit = false,
  2005. curLeft, swipeDirection, swipeLength, positionOffset, touches, verticalSwipeLength;
  2006. touches = event.originalEvent !== undefined ? event.originalEvent.touches : null;
  2007. if (!_.dragging || _.scrolling || touches && touches.length !== 1) {
  2008. return false;
  2009. }
  2010. curLeft = _.getLeft(_.currentSlide);
  2011. _.touchObject.curX = touches !== undefined ? touches[0].pageX : event.clientX;
  2012. _.touchObject.curY = touches !== undefined ? touches[0].pageY : event.clientY;
  2013. _.touchObject.swipeLength = Math.round(Math.sqrt(
  2014. Math.pow(_.touchObject.curX - _.touchObject.startX, 2)));
  2015. verticalSwipeLength = Math.round(Math.sqrt(
  2016. Math.pow(_.touchObject.curY - _.touchObject.startY, 2)));
  2017. if (!_.options.verticalSwiping && !_.swiping && verticalSwipeLength > 4) {
  2018. _.scrolling = true;
  2019. return false;
  2020. }
  2021. if (_.options.verticalSwiping === true) {
  2022. _.touchObject.swipeLength = verticalSwipeLength;
  2023. }
  2024. swipeDirection = _.swipeDirection();
  2025. if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) {
  2026. _.swiping = true;
  2027. event.preventDefault();
  2028. }
  2029. positionOffset = (_.options.rtl === false ? 1 : -1) * (_.touchObject.curX > _.touchObject.startX ? 1 : -1);
  2030. if (_.options.verticalSwiping === true) {
  2031. positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1;
  2032. }
  2033. swipeLength = _.touchObject.swipeLength;
  2034. _.touchObject.edgeHit = false;
  2035. if (_.options.infinite === false) {
  2036. if ((_.currentSlide === 0 && swipeDirection === 'right') || (_.currentSlide >= _.getDotCount() && swipeDirection === 'left')) {
  2037. swipeLength = _.touchObject.swipeLength * _.options.edgeFriction;
  2038. _.touchObject.edgeHit = true;
  2039. }
  2040. }
  2041. if (_.options.vertical === false) {
  2042. _.swipeLeft = curLeft + swipeLength * positionOffset;
  2043. } else {
  2044. _.swipeLeft = curLeft + (swipeLength * (_.$list.height() / _.listWidth)) * positionOffset;
  2045. }
  2046. if (_.options.verticalSwiping === true) {
  2047. _.swipeLeft = curLeft + swipeLength * positionOffset;
  2048. }
  2049. if (_.options.fade === true || _.options.touchMove === false) {
  2050. return false;
  2051. }
  2052. if (_.animating === true) {
  2053. _.swipeLeft = null;
  2054. return false;
  2055. }
  2056. _.setCSS(_.swipeLeft);
  2057. };
  2058. Slick.prototype.swipeStart = function(event) {
  2059. var _ = this,
  2060. touches;
  2061. _.interrupted = true;
  2062. if (_.touchObject.fingerCount !== 1 || _.slideCount <= _.options.slidesToShow) {
  2063. _.touchObject = {};
  2064. return false;
  2065. }
  2066. if (event.originalEvent !== undefined && event.originalEvent.touches !== undefined) {
  2067. touches = event.originalEvent.touches[0];
  2068. }
  2069. _.touchObject.startX = _.touchObject.curX = touches !== undefined ? touches.pageX : event.clientX;
  2070. _.touchObject.startY = _.touchObject.curY = touches !== undefined ? touches.pageY : event.clientY;
  2071. _.dragging = true;
  2072. };
  2073. Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function() {
  2074. var _ = this;
  2075. if (_.$slidesCache !== null) {
  2076. _.unload();
  2077. _.$slideTrack.children(this.options.slide).detach();
  2078. _.$slidesCache.appendTo(_.$slideTrack);
  2079. _.reinit();
  2080. }
  2081. };
  2082. Slick.prototype.unload = function() {
  2083. var _ = this;
  2084. $('.slick-cloned', _.$slider).remove();
  2085. if (_.$dots) {
  2086. _.$dots.remove();
  2087. }
  2088. if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) {
  2089. _.$prevArrow.remove();
  2090. }
  2091. if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) {
  2092. _.$nextArrow.remove();
  2093. }
  2094. _.$slides
  2095. .removeClass('slick-slide slick-active slick-visible slick-current')
  2096. .attr('aria-hidden', 'true')
  2097. .css('width', '');
  2098. };
  2099. Slick.prototype.unslick = function(fromBreakpoint) {
  2100. var _ = this;
  2101. _.$slider.trigger('unslick', [_, fromBreakpoint]);
  2102. _.destroy();
  2103. };
  2104. Slick.prototype.updateArrows = function() {
  2105. var _ = this,
  2106. centerOffset;
  2107. centerOffset = Math.floor(_.options.slidesToShow / 2);
  2108. if ( _.options.arrows === true &&
  2109. _.slideCount > _.options.slidesToShow &&
  2110. !_.options.infinite ) {
  2111. _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
  2112. _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
  2113. if (_.currentSlide === 0) {
  2114. _.$prevArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
  2115. _.$nextArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
  2116. } else if (_.currentSlide >= _.slideCount - _.options.slidesToShow && _.options.centerMode === false) {
  2117. _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
  2118. _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
  2119. } else if (_.currentSlide >= _.slideCount - 1 && _.options.centerMode === true) {
  2120. _.$nextArrow.addClass('slick-disabled').attr('aria-disabled', 'true');
  2121. _.$prevArrow.removeClass('slick-disabled').attr('aria-disabled', 'false');
  2122. }
  2123. }
  2124. };
  2125. Slick.prototype.updateDots = function() {
  2126. var _ = this;
  2127. if (_.$dots !== null) {
  2128. _.$dots
  2129. .find('li')
  2130. .removeClass('slick-active')
  2131. .end();
  2132. _.$dots
  2133. .find('li')
  2134. .eq(Math.floor(_.currentSlide / _.options.slidesToScroll))
  2135. .addClass('slick-active');
  2136. }
  2137. };
  2138. Slick.prototype.visibility = function() {
  2139. var _ = this;
  2140. if ( _.options.autoplay ) {
  2141. if ( document[_.hidden] ) {
  2142. _.interrupted = true;
  2143. } else {
  2144. _.interrupted = false;
  2145. }
  2146. }
  2147. };
  2148. $.fn.slick = function() {
  2149. var _ = this,
  2150. opt = arguments[0],
  2151. args = Array.prototype.slice.call(arguments, 1),
  2152. l = _.length,
  2153. i,
  2154. ret;
  2155. for (i = 0; i < l; i++) {
  2156. if (typeof opt == 'object' || typeof opt == 'undefined')
  2157. _[i].slick = new Slick(_[i], opt);
  2158. else
  2159. ret = _[i].slick[opt].apply(_[i].slick, args);
  2160. if (typeof ret != 'undefined') return ret;
  2161. }
  2162. return _;
  2163. };
  2164. }));