| 1 |
/* |
| 2 |
_ _ _ _ |
| 3 |
___| (_) ___| | __ (_)___ |
| 4 |
/ __| | |/ __| |/ / | / __| |
| 5 |
\__ \ | | (__| < _ | \__ \ |
| 6 |
|___/_|_|\___|_|\_(_)/ |___/ |
| 7 |
|__/ |
| 8 |
|
| 9 |
Version: 1.8.1 |
| 10 |
Author: Ken Wheeler |
| 11 |
Website: http://kenwheeler.github.io |
| 12 |
Docs: http://kenwheeler.github.io/slick |
| 13 |
Repo: http://github.com/kenwheeler/slick |
| 14 |
Issues: http://github.com/kenwheeler/slick/issues |
| 15 |
|
| 16 |
*/ |
| 17 |
/* global window, document, define, jQuery, setInterval, clearInterval */ |
| 18 |
(function (factory) { |
| 19 |
"use strict"; |
| 20 |
if (typeof define === "function" && define.amd) { |
| 21 |
define(["jquery"], factory); |
| 22 |
} else if (typeof exports !== "undefined") { |
| 23 |
module.exports = factory(require("jquery")); |
| 24 |
} else { |
| 25 |
factory(jQuery); |
| 26 |
} |
| 27 |
})(function ($) { |
| 28 |
"use strict"; |
| 29 |
var Slick = window.Slick || {}; |
| 30 |
|
| 31 |
Slick = (function () { |
| 32 |
var instanceUid = 0; |
| 33 |
|
| 34 |
function Slick(element, settings) { |
| 35 |
var _ = this, |
| 36 |
dataSettings; |
| 37 |
|
| 38 |
_.defaults = { |
| 39 |
accessibility: true, |
| 40 |
adaptiveHeight: false, |
| 41 |
appendArrows: $(element), |
| 42 |
appendDots: $(element), |
| 43 |
arrows: true, |
| 44 |
asNavFor: null, |
| 45 |
prevArrow: |
| 46 |
'<button class="slick-prev" aria-label="Previous" type="button">Previous</button>', |
| 47 |
nextArrow: |
| 48 |
'<button class="slick-next" aria-label="Next" type="button">Next</button>', |
| 49 |
autoplay: false, |
| 50 |
autoplaySpeed: 3000, |
| 51 |
centerMode: false, |
| 52 |
centerPadding: "50px", |
| 53 |
cssEase: "ease", |
| 54 |
customPaging: function (slider, i) { |
| 55 |
return $('<button type="button" />').text(i + 1); |
| 56 |
}, |
| 57 |
dots: false, |
| 58 |
dotsClass: "slick-dots", |
| 59 |
draggable: true, |
| 60 |
easing: "linear", |
| 61 |
edgeFriction: 0.35, |
| 62 |
fade: false, |
| 63 |
focusOnSelect: false, |
| 64 |
focusOnChange: false, |
| 65 |
infinite: true, |
| 66 |
initialSlide: 0, |
| 67 |
lazyLoad: "ondemand", |
| 68 |
mobileFirst: false, |
| 69 |
pauseOnHover: true, |
| 70 |
pauseOnFocus: true, |
| 71 |
pauseOnDotsHover: false, |
| 72 |
respondTo: "window", |
| 73 |
responsive: null, |
| 74 |
rows: 1, |
| 75 |
rtl: false, |
| 76 |
slide: "", |
| 77 |
slidesPerRow: 1, |
| 78 |
slidesToShow: 1, |
| 79 |
slidesToScroll: 1, |
| 80 |
speed: 500, |
| 81 |
swipe: true, |
| 82 |
swipeToSlide: false, |
| 83 |
touchMove: true, |
| 84 |
touchThreshold: 5, |
| 85 |
useCSS: true, |
| 86 |
useTransform: true, |
| 87 |
variableWidth: false, |
| 88 |
vertical: false, |
| 89 |
verticalSwiping: false, |
| 90 |
waitForAnimate: true, |
| 91 |
zIndex: 1000, |
| 92 |
}; |
| 93 |
|
| 94 |
_.initials = { |
| 95 |
animating: false, |
| 96 |
dragging: false, |
| 97 |
autoPlayTimer: null, |
| 98 |
currentDirection: 0, |
| 99 |
currentLeft: null, |
| 100 |
currentSlide: 0, |
| 101 |
direction: 1, |
| 102 |
$dots: null, |
| 103 |
listWidth: null, |
| 104 |
listHeight: null, |
| 105 |
loadIndex: 0, |
| 106 |
$nextArrow: null, |
| 107 |
$prevArrow: null, |
| 108 |
scrolling: false, |
| 109 |
slideCount: null, |
| 110 |
slideWidth: null, |
| 111 |
$slideTrack: null, |
| 112 |
$slides: null, |
| 113 |
sliding: false, |
| 114 |
slideOffset: 0, |
| 115 |
swipeLeft: null, |
| 116 |
swiping: false, |
| 117 |
$list: null, |
| 118 |
touchObject: {}, |
| 119 |
transformsEnabled: false, |
| 120 |
unslicked: false, |
| 121 |
}; |
| 122 |
|
| 123 |
$.extend(_, _.initials); |
| 124 |
|
| 125 |
_.activeBreakpoint = null; |
| 126 |
_.animType = null; |
| 127 |
_.animProp = null; |
| 128 |
_.breakpoints = []; |
| 129 |
_.breakpointSettings = []; |
| 130 |
_.cssTransitions = false; |
| 131 |
_.focussed = false; |
| 132 |
_.interrupted = false; |
| 133 |
_.hidden = "hidden"; |
| 134 |
_.paused = true; |
| 135 |
_.positionProp = null; |
| 136 |
_.respondTo = null; |
| 137 |
_.rowCount = 1; |
| 138 |
_.shouldClick = true; |
| 139 |
_.$slider = $(element); |
| 140 |
_.$slidesCache = null; |
| 141 |
_.transformType = null; |
| 142 |
_.transitionType = null; |
| 143 |
_.visibilityChange = "visibilitychange"; |
| 144 |
_.windowWidth = 0; |
| 145 |
_.windowTimer = null; |
| 146 |
|
| 147 |
dataSettings = $(element).data("slick") || {}; |
| 148 |
|
| 149 |
_.options = $.extend({}, _.defaults, settings, dataSettings); |
| 150 |
|
| 151 |
_.currentSlide = _.options.initialSlide; |
| 152 |
|
| 153 |
_.originalSettings = _.options; |
| 154 |
|
| 155 |
if (typeof document.mozHidden !== "undefined") { |
| 156 |
_.hidden = "mozHidden"; |
| 157 |
_.visibilityChange = "mozvisibilitychange"; |
| 158 |
} else if (typeof document.webkitHidden !== "undefined") { |
| 159 |
_.hidden = "webkitHidden"; |
| 160 |
_.visibilityChange = "webkitvisibilitychange"; |
| 161 |
} |
| 162 |
|
| 163 |
_.autoPlay = $.proxy(_.autoPlay, _); |
| 164 |
_.autoPlayClear = $.proxy(_.autoPlayClear, _); |
| 165 |
_.autoPlayIterator = $.proxy(_.autoPlayIterator, _); |
| 166 |
_.changeSlide = $.proxy(_.changeSlide, _); |
| 167 |
_.clickHandler = $.proxy(_.clickHandler, _); |
| 168 |
_.selectHandler = $.proxy(_.selectHandler, _); |
| 169 |
_.setPosition = $.proxy(_.setPosition, _); |
| 170 |
_.swipeHandler = $.proxy(_.swipeHandler, _); |
| 171 |
_.dragHandler = $.proxy(_.dragHandler, _); |
| 172 |
_.keyHandler = $.proxy(_.keyHandler, _); |
| 173 |
|
| 174 |
_.instanceUid = instanceUid++; |
| 175 |
|
| 176 |
// A simple way to check for HTML strings |
| 177 |
// Strict HTML recognition (must start with <) |
| 178 |
// Extracted from jQuery v1.11 source |
| 179 |
_.htmlExpr = /^(?:\s*(<[\w\W]+>)[^>]*)$/; |
| 180 |
|
| 181 |
_.registerBreakpoints(); |
| 182 |
_.init(true); |
| 183 |
} |
| 184 |
|
| 185 |
return Slick; |
| 186 |
})(); |
| 187 |
|
| 188 |
Slick.prototype.activateADA = function () { |
| 189 |
var _ = this; |
| 190 |
|
| 191 |
_.$slideTrack |
| 192 |
.find(".slick-active") |
| 193 |
.attr({ |
| 194 |
"aria-hidden": "false", |
| 195 |
}) |
| 196 |
.find("a, input, button, select") |
| 197 |
.attr({ |
| 198 |
tabindex: "0", |
| 199 |
}); |
| 200 |
}; |
| 201 |
|
| 202 |
Slick.prototype.addSlide = Slick.prototype.slickAdd = function ( |
| 203 |
markup, |
| 204 |
index, |
| 205 |
addBefore |
| 206 |
) { |
| 207 |
var _ = this; |
| 208 |
|
| 209 |
if (typeof index === "boolean") { |
| 210 |
addBefore = index; |
| 211 |
index = null; |
| 212 |
} else if (index < 0 || index >= _.slideCount) { |
| 213 |
return false; |
| 214 |
} |
| 215 |
|
| 216 |
_.unload(); |
| 217 |
|
| 218 |
if (typeof index === "number") { |
| 219 |
if (index === 0 && _.$slides.length === 0) { |
| 220 |
$(markup).appendTo(_.$slideTrack); |
| 221 |
} else if (addBefore) { |
| 222 |
$(markup).insertBefore(_.$slides.eq(index)); |
| 223 |
} else { |
| 224 |
$(markup).insertAfter(_.$slides.eq(index)); |
| 225 |
} |
| 226 |
} else { |
| 227 |
if (addBefore === true) { |
| 228 |
$(markup).prependTo(_.$slideTrack); |
| 229 |
} else { |
| 230 |
$(markup).appendTo(_.$slideTrack); |
| 231 |
} |
| 232 |
} |
| 233 |
|
| 234 |
_.$slides = _.$slideTrack.children(this.options.slide); |
| 235 |
|
| 236 |
_.$slideTrack.children(this.options.slide).detach(); |
| 237 |
|
| 238 |
_.$slideTrack.append(_.$slides); |
| 239 |
|
| 240 |
_.$slides.each(function (index, element) { |
| 241 |
$(element).attr("data-slick-index", index); |
| 242 |
}); |
| 243 |
|
| 244 |
_.$slidesCache = _.$slides; |
| 245 |
|
| 246 |
_.reinit(); |
| 247 |
}; |
| 248 |
|
| 249 |
Slick.prototype.animateHeight = function () { |
| 250 |
var _ = this; |
| 251 |
if ( |
| 252 |
_.options.slidesToShow === 1 && |
| 253 |
_.options.adaptiveHeight === true && |
| 254 |
_.options.vertical === false |
| 255 |
) { |
| 256 |
var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); |
| 257 |
_.$list.animate( |
| 258 |
{ |
| 259 |
height: targetHeight, |
| 260 |
}, |
| 261 |
_.options.speed |
| 262 |
); |
| 263 |
} |
| 264 |
}; |
| 265 |
|
| 266 |
Slick.prototype.animateSlide = function (targetLeft, callback) { |
| 267 |
var animProps = {}, |
| 268 |
_ = this; |
| 269 |
|
| 270 |
_.animateHeight(); |
| 271 |
|
| 272 |
if (_.options.rtl === true && _.options.vertical === false) { |
| 273 |
targetLeft = -targetLeft; |
| 274 |
} |
| 275 |
if (_.transformsEnabled === false) { |
| 276 |
if (_.options.vertical === false) { |
| 277 |
_.$slideTrack.animate( |
| 278 |
{ |
| 279 |
left: targetLeft, |
| 280 |
}, |
| 281 |
_.options.speed, |
| 282 |
_.options.easing, |
| 283 |
callback |
| 284 |
); |
| 285 |
} else { |
| 286 |
_.$slideTrack.animate( |
| 287 |
{ |
| 288 |
top: targetLeft, |
| 289 |
}, |
| 290 |
_.options.speed, |
| 291 |
_.options.easing, |
| 292 |
callback |
| 293 |
); |
| 294 |
} |
| 295 |
} else { |
| 296 |
if (_.cssTransitions === false) { |
| 297 |
if (_.options.rtl === true) { |
| 298 |
_.currentLeft = -_.currentLeft; |
| 299 |
} |
| 300 |
$({ |
| 301 |
animStart: _.currentLeft, |
| 302 |
}).animate( |
| 303 |
{ |
| 304 |
animStart: targetLeft, |
| 305 |
}, |
| 306 |
{ |
| 307 |
duration: _.options.speed, |
| 308 |
easing: _.options.easing, |
| 309 |
step: function (now) { |
| 310 |
now = Math.ceil(now); |
| 311 |
if (_.options.vertical === false) { |
| 312 |
animProps[_.animType] = "translate(" + now + "px, 0px)"; |
| 313 |
_.$slideTrack.css(animProps); |
| 314 |
} else { |
| 315 |
animProps[_.animType] = "translate(0px," + now + "px)"; |
| 316 |
_.$slideTrack.css(animProps); |
| 317 |
} |
| 318 |
}, |
| 319 |
complete: function () { |
| 320 |
if (callback) { |
| 321 |
callback.call(); |
| 322 |
} |
| 323 |
}, |
| 324 |
} |
| 325 |
); |
| 326 |
} else { |
| 327 |
_.applyTransition(); |
| 328 |
targetLeft = Math.ceil(targetLeft); |
| 329 |
|
| 330 |
if (_.options.vertical === false) { |
| 331 |
animProps[_.animType] = "translate3d(" + targetLeft + "px, 0px, 0px)"; |
| 332 |
} else { |
| 333 |
animProps[_.animType] = "translate3d(0px," + targetLeft + "px, 0px)"; |
| 334 |
} |
| 335 |
_.$slideTrack.css(animProps); |
| 336 |
|
| 337 |
if (callback) { |
| 338 |
setTimeout(function () { |
| 339 |
_.disableTransition(); |
| 340 |
|
| 341 |
callback.call(); |
| 342 |
}, _.options.speed); |
| 343 |
} |
| 344 |
} |
| 345 |
} |
| 346 |
}; |
| 347 |
|
| 348 |
Slick.prototype.getNavTarget = function () { |
| 349 |
var _ = this, |
| 350 |
asNavFor = _.options.asNavFor; |
| 351 |
|
| 352 |
if (asNavFor && asNavFor !== null) { |
| 353 |
asNavFor = $(asNavFor).not(_.$slider); |
| 354 |
} |
| 355 |
|
| 356 |
return asNavFor; |
| 357 |
}; |
| 358 |
|
| 359 |
Slick.prototype.asNavFor = function (index) { |
| 360 |
var _ = this, |
| 361 |
asNavFor = _.getNavTarget(); |
| 362 |
|
| 363 |
if (asNavFor !== null && typeof asNavFor === "object") { |
| 364 |
asNavFor.each(function () { |
| 365 |
var target = $(this).slick("getSlick"); |
| 366 |
if (!target.unslicked) { |
| 367 |
target.slideHandler(index, true); |
| 368 |
} |
| 369 |
}); |
| 370 |
} |
| 371 |
}; |
| 372 |
|
| 373 |
Slick.prototype.applyTransition = function (slide) { |
| 374 |
var _ = this, |
| 375 |
transition = {}; |
| 376 |
|
| 377 |
if (_.options.fade === false) { |
| 378 |
transition[_.transitionType] = |
| 379 |
_.transformType + " " + _.options.speed + "ms " + _.options.cssEase; |
| 380 |
} else { |
| 381 |
transition[_.transitionType] = |
| 382 |
"opacity " + _.options.speed + "ms " + _.options.cssEase; |
| 383 |
} |
| 384 |
|
| 385 |
if (_.options.fade === false) { |
| 386 |
_.$slideTrack.css(transition); |
| 387 |
} else { |
| 388 |
_.$slides.eq(slide).css(transition); |
| 389 |
} |
| 390 |
}; |
| 391 |
|
| 392 |
Slick.prototype.autoPlay = function () { |
| 393 |
var _ = this; |
| 394 |
|
| 395 |
_.autoPlayClear(); |
| 396 |
|
| 397 |
if (_.slideCount > _.options.slidesToShow) { |
| 398 |
_.autoPlayTimer = setInterval( |
| 399 |
_.autoPlayIterator, |
| 400 |
_.options.autoplaySpeed |
| 401 |
); |
| 402 |
} |
| 403 |
}; |
| 404 |
|
| 405 |
Slick.prototype.autoPlayClear = function () { |
| 406 |
var _ = this; |
| 407 |
|
| 408 |
if (_.autoPlayTimer) { |
| 409 |
clearInterval(_.autoPlayTimer); |
| 410 |
} |
| 411 |
}; |
| 412 |
|
| 413 |
Slick.prototype.autoPlayIterator = function () { |
| 414 |
var _ = this, |
| 415 |
slideTo = _.currentSlide + _.options.slidesToScroll; |
| 416 |
|
| 417 |
if (!_.paused && !_.interrupted && !_.focussed) { |
| 418 |
if (_.options.infinite === false) { |
| 419 |
if (_.direction === 1 && _.currentSlide + 1 === _.slideCount - 1) { |
| 420 |
_.direction = 0; |
| 421 |
} else if (_.direction === 0) { |
| 422 |
slideTo = _.currentSlide - _.options.slidesToScroll; |
| 423 |
|
| 424 |
if (_.currentSlide - 1 === 0) { |
| 425 |
_.direction = 1; |
| 426 |
} |
| 427 |
} |
| 428 |
} |
| 429 |
|
| 430 |
_.slideHandler(slideTo); |
| 431 |
} |
| 432 |
}; |
| 433 |
|
| 434 |
Slick.prototype.buildArrows = function () { |
| 435 |
var _ = this; |
| 436 |
|
| 437 |
if (_.options.arrows === true) { |
| 438 |
_.$prevArrow = $(_.options.prevArrow).addClass("slick-arrow"); |
| 439 |
_.$nextArrow = $(_.options.nextArrow).addClass("slick-arrow"); |
| 440 |
|
| 441 |
if (_.slideCount > _.options.slidesToShow) { |
| 442 |
_.$prevArrow |
| 443 |
.removeClass("slick-hidden") |
| 444 |
.removeAttr("aria-hidden tabindex"); |
| 445 |
_.$nextArrow |
| 446 |
.removeClass("slick-hidden") |
| 447 |
.removeAttr("aria-hidden tabindex"); |
| 448 |
|
| 449 |
if (_.htmlExpr.test(_.options.prevArrow)) { |
| 450 |
_.$prevArrow.prependTo(_.options.appendArrows); |
| 451 |
} |
| 452 |
|
| 453 |
if (_.htmlExpr.test(_.options.nextArrow)) { |
| 454 |
_.$nextArrow.appendTo(_.options.appendArrows); |
| 455 |
} |
| 456 |
|
| 457 |
if (_.options.infinite !== true) { |
| 458 |
_.$prevArrow.addClass("slick-disabled").attr("aria-disabled", "true"); |
| 459 |
} |
| 460 |
} else { |
| 461 |
_.$prevArrow |
| 462 |
.add(_.$nextArrow) |
| 463 |
|
| 464 |
.addClass("slick-hidden") |
| 465 |
.attr({ |
| 466 |
"aria-disabled": "true", |
| 467 |
tabindex: "-1", |
| 468 |
}); |
| 469 |
} |
| 470 |
} |
| 471 |
}; |
| 472 |
|
| 473 |
Slick.prototype.buildDots = function () { |
| 474 |
var _ = this, |
| 475 |
i, |
| 476 |
dot; |
| 477 |
|
| 478 |
if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { |
| 479 |
_.$slider.addClass("slick-dotted"); |
| 480 |
|
| 481 |
dot = $("<ul />").addClass(_.options.dotsClass); |
| 482 |
|
| 483 |
for (i = 0; i <= _.getDotCount(); i += 1) { |
| 484 |
dot.append($("<li />").append(_.options.customPaging.call(this, _, i))); |
| 485 |
} |
| 486 |
|
| 487 |
_.$dots = dot.appendTo(_.options.appendDots); |
| 488 |
|
| 489 |
_.$dots.find("li").first().addClass("slick-active"); |
| 490 |
} |
| 491 |
}; |
| 492 |
|
| 493 |
Slick.prototype.buildOut = function () { |
| 494 |
var _ = this; |
| 495 |
|
| 496 |
_.$slides = _.$slider |
| 497 |
.children(_.options.slide + ":not(.slick-cloned)") |
| 498 |
.addClass("slick-slide"); |
| 499 |
|
| 500 |
_.slideCount = _.$slides.length; |
| 501 |
|
| 502 |
_.$slides.each(function (index, element) { |
| 503 |
$(element) |
| 504 |
.attr("data-slick-index", index) |
| 505 |
.data("originalStyling", $(element).attr("style") || ""); |
| 506 |
}); |
| 507 |
|
| 508 |
_.$slider.addClass("slick-slider"); |
| 509 |
|
| 510 |
_.$slideTrack = |
| 511 |
_.slideCount === 0 |
| 512 |
? $('<div class="slick-track"/>').appendTo(_.$slider) |
| 513 |
: _.$slides.wrapAll('<div class="slick-track"/>').parent(); |
| 514 |
|
| 515 |
_.$list = _.$slideTrack.wrap('<div class="slick-list"/>').parent(); |
| 516 |
_.$slideTrack.css("opacity", 0); |
| 517 |
|
| 518 |
if (_.options.centerMode === true || _.options.swipeToSlide === true) { |
| 519 |
_.options.slidesToScroll = 1; |
| 520 |
} |
| 521 |
|
| 522 |
$("img[data-lazy]", _.$slider).not("[src]").addClass("slick-loading"); |
| 523 |
|
| 524 |
_.setupInfinite(); |
| 525 |
|
| 526 |
_.buildArrows(); |
| 527 |
|
| 528 |
_.buildDots(); |
| 529 |
|
| 530 |
_.updateDots(); |
| 531 |
|
| 532 |
_.setSlideClasses(typeof _.currentSlide === "number" ? _.currentSlide : 0); |
| 533 |
|
| 534 |
if (_.options.draggable === true) { |
| 535 |
_.$list.addClass("draggable"); |
| 536 |
} |
| 537 |
}; |
| 538 |
|
| 539 |
Slick.prototype.buildRows = function () { |
| 540 |
var _ = this, |
| 541 |
a, |
| 542 |
b, |
| 543 |
c, |
| 544 |
newSlides, |
| 545 |
numOfSlides, |
| 546 |
originalSlides, |
| 547 |
slidesPerSection; |
| 548 |
|
| 549 |
newSlides = document.createDocumentFragment(); |
| 550 |
originalSlides = _.$slider.children(); |
| 551 |
|
| 552 |
if (_.options.rows > 0) { |
| 553 |
slidesPerSection = _.options.slidesPerRow * _.options.rows; |
| 554 |
numOfSlides = Math.ceil(originalSlides.length / slidesPerSection); |
| 555 |
|
| 556 |
for (a = 0; a < numOfSlides; a++) { |
| 557 |
var slide = document.createElement("div"); |
| 558 |
for (b = 0; b < _.options.rows; b++) { |
| 559 |
var row = document.createElement("div"); |
| 560 |
for (c = 0; c < _.options.slidesPerRow; c++) { |
| 561 |
var target = |
| 562 |
a * slidesPerSection + (b * _.options.slidesPerRow + c); |
| 563 |
if (originalSlides.get(target)) { |
| 564 |
row.appendChild(originalSlides.get(target)); |
| 565 |
} |
| 566 |
} |
| 567 |
slide.appendChild(row); |
| 568 |
} |
| 569 |
newSlides.appendChild(slide); |
| 570 |
} |
| 571 |
|
| 572 |
_.$slider.empty().append(newSlides); |
| 573 |
_.$slider |
| 574 |
.children() |
| 575 |
.children() |
| 576 |
.children() |
| 577 |
.css({ |
| 578 |
width: 100 / _.options.slidesPerRow + "%", |
| 579 |
display: "inline-block", |
| 580 |
}); |
| 581 |
} |
| 582 |
}; |
| 583 |
|
| 584 |
Slick.prototype.checkResponsive = function (initial, forceUpdate) { |
| 585 |
var _ = this, |
| 586 |
breakpoint, |
| 587 |
targetBreakpoint, |
| 588 |
respondToWidth, |
| 589 |
triggerBreakpoint = false; |
| 590 |
var sliderWidth = _.$slider.width(); |
| 591 |
var windowWidth = window.innerWidth || $(window).width(); |
| 592 |
|
| 593 |
if (_.respondTo === "window") { |
| 594 |
respondToWidth = windowWidth; |
| 595 |
} else if (_.respondTo === "slider") { |
| 596 |
respondToWidth = sliderWidth; |
| 597 |
} else if (_.respondTo === "min") { |
| 598 |
respondToWidth = Math.min(windowWidth, sliderWidth); |
| 599 |
} |
| 600 |
|
| 601 |
if ( |
| 602 |
_.options.responsive && |
| 603 |
_.options.responsive.length && |
| 604 |
_.options.responsive !== null |
| 605 |
) { |
| 606 |
targetBreakpoint = null; |
| 607 |
|
| 608 |
for (breakpoint in _.breakpoints) { |
| 609 |
if (_.breakpoints.hasOwnProperty(breakpoint)) { |
| 610 |
if (_.originalSettings.mobileFirst === false) { |
| 611 |
if (respondToWidth < _.breakpoints[breakpoint]) { |
| 612 |
targetBreakpoint = _.breakpoints[breakpoint]; |
| 613 |
} |
| 614 |
} else { |
| 615 |
if (respondToWidth > _.breakpoints[breakpoint]) { |
| 616 |
targetBreakpoint = _.breakpoints[breakpoint]; |
| 617 |
} |
| 618 |
} |
| 619 |
} |
| 620 |
} |
| 621 |
|
| 622 |
if (targetBreakpoint !== null) { |
| 623 |
if (_.activeBreakpoint !== null) { |
| 624 |
if (targetBreakpoint !== _.activeBreakpoint || forceUpdate) { |
| 625 |
_.activeBreakpoint = targetBreakpoint; |
| 626 |
if (_.breakpointSettings[targetBreakpoint] === "unslick") { |
| 627 |
_.unslick(targetBreakpoint); |
| 628 |
} else { |
| 629 |
_.options = $.extend( |
| 630 |
{}, |
| 631 |
_.originalSettings, |
| 632 |
_.breakpointSettings[targetBreakpoint] |
| 633 |
); |
| 634 |
if (initial === true) { |
| 635 |
_.currentSlide = _.options.initialSlide; |
| 636 |
} |
| 637 |
_.refresh(initial); |
| 638 |
} |
| 639 |
triggerBreakpoint = targetBreakpoint; |
| 640 |
} |
| 641 |
} else { |
| 642 |
_.activeBreakpoint = targetBreakpoint; |
| 643 |
if (_.breakpointSettings[targetBreakpoint] === "unslick") { |
| 644 |
_.unslick(targetBreakpoint); |
| 645 |
} else { |
| 646 |
_.options = $.extend( |
| 647 |
{}, |
| 648 |
_.originalSettings, |
| 649 |
_.breakpointSettings[targetBreakpoint] |
| 650 |
); |
| 651 |
if (initial === true) { |
| 652 |
_.currentSlide = _.options.initialSlide; |
| 653 |
} |
| 654 |
_.refresh(initial); |
| 655 |
} |
| 656 |
triggerBreakpoint = targetBreakpoint; |
| 657 |
} |
| 658 |
} else { |
| 659 |
if (_.activeBreakpoint !== null) { |
| 660 |
_.activeBreakpoint = null; |
| 661 |
_.options = _.originalSettings; |
| 662 |
if (initial === true) { |
| 663 |
_.currentSlide = _.options.initialSlide; |
| 664 |
} |
| 665 |
_.refresh(initial); |
| 666 |
triggerBreakpoint = targetBreakpoint; |
| 667 |
} |
| 668 |
} |
| 669 |
|
| 670 |
// only trigger breakpoints during an actual break. not on initialize. |
| 671 |
if (!initial && triggerBreakpoint !== false) { |
| 672 |
_.$slider.trigger("breakpoint", [_, triggerBreakpoint]); |
| 673 |
} |
| 674 |
} |
| 675 |
}; |
| 676 |
|
| 677 |
Slick.prototype.changeSlide = function (event, dontAnimate) { |
| 678 |
var _ = this, |
| 679 |
$target = $(event.currentTarget), |
| 680 |
indexOffset, |
| 681 |
slideOffset, |
| 682 |
unevenOffset; |
| 683 |
|
| 684 |
// If target is a link, prevent default action. |
| 685 |
if ($target.is("a")) { |
| 686 |
event.preventDefault(); |
| 687 |
} |
| 688 |
|
| 689 |
// If target is not the <li> element (ie: a child), find the <li>. |
| 690 |
if (!$target.is("li")) { |
| 691 |
$target = $target.closest("li"); |
| 692 |
} |
| 693 |
|
| 694 |
unevenOffset = _.slideCount % _.options.slidesToScroll !== 0; |
| 695 |
indexOffset = unevenOffset |
| 696 |
? 0 |
| 697 |
: (_.slideCount - _.currentSlide) % _.options.slidesToScroll; |
| 698 |
|
| 699 |
switch (event.data.message) { |
| 700 |
case "previous": |
| 701 |
slideOffset = |
| 702 |
indexOffset === 0 |
| 703 |
? _.options.slidesToScroll |
| 704 |
: _.options.slidesToShow - indexOffset; |
| 705 |
if (_.slideCount > _.options.slidesToShow) { |
| 706 |
_.slideHandler(_.currentSlide - slideOffset, false, dontAnimate); |
| 707 |
} |
| 708 |
break; |
| 709 |
|
| 710 |
case "next": |
| 711 |
slideOffset = |
| 712 |
indexOffset === 0 ? _.options.slidesToScroll : indexOffset; |
| 713 |
if (_.slideCount > _.options.slidesToShow) { |
| 714 |
_.slideHandler(_.currentSlide + slideOffset, false, dontAnimate); |
| 715 |
} |
| 716 |
break; |
| 717 |
|
| 718 |
case "index": |
| 719 |
var index = |
| 720 |
event.data.index === 0 |
| 721 |
? 0 |
| 722 |
: event.data.index || $target.index() * _.options.slidesToScroll; |
| 723 |
|
| 724 |
_.slideHandler(_.checkNavigable(index), false, dontAnimate); |
| 725 |
$target.children().trigger("focus"); |
| 726 |
break; |
| 727 |
|
| 728 |
default: |
| 729 |
return; |
| 730 |
} |
| 731 |
}; |
| 732 |
|
| 733 |
Slick.prototype.checkNavigable = function (index) { |
| 734 |
var _ = this, |
| 735 |
navigables, |
| 736 |
prevNavigable; |
| 737 |
|
| 738 |
navigables = _.getNavigableIndexes(); |
| 739 |
prevNavigable = 0; |
| 740 |
if (index > navigables[navigables.length - 1]) { |
| 741 |
index = navigables[navigables.length - 1]; |
| 742 |
} else { |
| 743 |
for (var n in navigables) { |
| 744 |
if (index < navigables[n]) { |
| 745 |
index = prevNavigable; |
| 746 |
break; |
| 747 |
} |
| 748 |
prevNavigable = navigables[n]; |
| 749 |
} |
| 750 |
} |
| 751 |
|
| 752 |
return index; |
| 753 |
}; |
| 754 |
|
| 755 |
Slick.prototype.cleanUpEvents = function () { |
| 756 |
var _ = this; |
| 757 |
|
| 758 |
if (_.options.dots && _.$dots !== null) { |
| 759 |
$("li", _.$dots) |
| 760 |
.off("click.slick", _.changeSlide) |
| 761 |
.off("mouseenter.slick", $.proxy(_.interrupt, _, true)) |
| 762 |
.off("mouseleave.slick", $.proxy(_.interrupt, _, false)); |
| 763 |
|
| 764 |
if (_.options.accessibility === true) { |
| 765 |
_.$dots.off("keydown.slick", _.keyHandler); |
| 766 |
} |
| 767 |
} |
| 768 |
|
| 769 |
_.$slider.off("focus.slick blur.slick"); |
| 770 |
|
| 771 |
if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { |
| 772 |
_.$prevArrow && _.$prevArrow.off("click.slick", _.changeSlide); |
| 773 |
_.$nextArrow && _.$nextArrow.off("click.slick", _.changeSlide); |
| 774 |
|
| 775 |
if (_.options.accessibility === true) { |
| 776 |
_.$prevArrow && _.$prevArrow.off("keydown.slick", _.keyHandler); |
| 777 |
_.$nextArrow && _.$nextArrow.off("keydown.slick", _.keyHandler); |
| 778 |
} |
| 779 |
} |
| 780 |
|
| 781 |
_.$list.off("touchstart.slick mousedown.slick", _.swipeHandler); |
| 782 |
_.$list.off("touchmove.slick mousemove.slick", _.swipeHandler); |
| 783 |
_.$list.off("touchend.slick mouseup.slick", _.swipeHandler); |
| 784 |
_.$list.off("touchcancel.slick mouseleave.slick", _.swipeHandler); |
| 785 |
|
| 786 |
_.$list.off("click.slick", _.clickHandler); |
| 787 |
|
| 788 |
$(document).off(_.visibilityChange, _.visibility); |
| 789 |
|
| 790 |
_.cleanUpSlideEvents(); |
| 791 |
|
| 792 |
if (_.options.accessibility === true) { |
| 793 |
_.$list.off("keydown.slick", _.keyHandler); |
| 794 |
} |
| 795 |
|
| 796 |
if (_.options.focusOnSelect === true) { |
| 797 |
$(_.$slideTrack).children().off("click.slick", _.selectHandler); |
| 798 |
} |
| 799 |
|
| 800 |
$(window).off( |
| 801 |
"orientationchange.slick.slick-" + _.instanceUid, |
| 802 |
_.orientationChange |
| 803 |
); |
| 804 |
|
| 805 |
$(window).off("resize.slick.slick-" + _.instanceUid, _.resize); |
| 806 |
|
| 807 |
$("[draggable!=true]", _.$slideTrack).off("dragstart", _.preventDefault); |
| 808 |
|
| 809 |
$(window).off("load.slick.slick-" + _.instanceUid, _.setPosition); |
| 810 |
}; |
| 811 |
|
| 812 |
Slick.prototype.cleanUpSlideEvents = function () { |
| 813 |
var _ = this; |
| 814 |
|
| 815 |
_.$list.off("mouseenter.slick", $.proxy(_.interrupt, _, true)); |
| 816 |
_.$list.off("mouseleave.slick", $.proxy(_.interrupt, _, false)); |
| 817 |
}; |
| 818 |
|
| 819 |
Slick.prototype.cleanUpRows = function () { |
| 820 |
var _ = this, |
| 821 |
originalSlides; |
| 822 |
|
| 823 |
if (_.options.rows > 0) { |
| 824 |
originalSlides = _.$slides.children().children(); |
| 825 |
originalSlides.removeAttr("style"); |
| 826 |
_.$slider.empty().append(originalSlides); |
| 827 |
} |
| 828 |
}; |
| 829 |
|
| 830 |
Slick.prototype.clickHandler = function (event) { |
| 831 |
var _ = this; |
| 832 |
|
| 833 |
if (_.shouldClick === false) { |
| 834 |
event.stopImmediatePropagation(); |
| 835 |
event.stopPropagation(); |
| 836 |
event.preventDefault(); |
| 837 |
} |
| 838 |
}; |
| 839 |
|
| 840 |
Slick.prototype.destroy = function (refresh) { |
| 841 |
var _ = this; |
| 842 |
|
| 843 |
_.autoPlayClear(); |
| 844 |
|
| 845 |
_.touchObject = {}; |
| 846 |
|
| 847 |
_.cleanUpEvents(); |
| 848 |
|
| 849 |
$(".slick-cloned", _.$slider).detach(); |
| 850 |
|
| 851 |
if (_.$dots) { |
| 852 |
_.$dots.remove(); |
| 853 |
} |
| 854 |
|
| 855 |
if (_.$prevArrow && _.$prevArrow.length) { |
| 856 |
_.$prevArrow |
| 857 |
.removeClass("slick-disabled slick-arrow slick-hidden") |
| 858 |
.removeAttr("aria-hidden aria-disabled tabindex") |
| 859 |
.css("display", ""); |
| 860 |
|
| 861 |
if (_.htmlExpr.test(_.options.prevArrow)) { |
| 862 |
_.$prevArrow.remove(); |
| 863 |
} |
| 864 |
} |
| 865 |
|
| 866 |
if (_.$nextArrow && _.$nextArrow.length) { |
| 867 |
_.$nextArrow |
| 868 |
.removeClass("slick-disabled slick-arrow slick-hidden") |
| 869 |
.removeAttr("aria-hidden aria-disabled tabindex") |
| 870 |
.css("display", ""); |
| 871 |
|
| 872 |
if (_.htmlExpr.test(_.options.nextArrow)) { |
| 873 |
_.$nextArrow.remove(); |
| 874 |
} |
| 875 |
} |
| 876 |
|
| 877 |
if (_.$slides) { |
| 878 |
_.$slides |
| 879 |
.removeClass( |
| 880 |
"slick-slide slick-active slick-center slick-visible slick-current" |
| 881 |
) |
| 882 |
.removeAttr("aria-hidden") |
| 883 |
.removeAttr("data-slick-index") |
| 884 |
.each(function () { |
| 885 |
$(this).attr("style", $(this).data("originalStyling")); |
| 886 |
}); |
| 887 |
|
| 888 |
_.$slideTrack.children(this.options.slide).detach(); |
| 889 |
|
| 890 |
_.$slideTrack.detach(); |
| 891 |
|
| 892 |
_.$list.detach(); |
| 893 |
|
| 894 |
_.$slider.append(_.$slides); |
| 895 |
} |
| 896 |
|
| 897 |
_.cleanUpRows(); |
| 898 |
|
| 899 |
_.$slider.removeClass("slick-slider"); |
| 900 |
_.$slider.removeClass("slick-initialized"); |
| 901 |
_.$slider.removeClass("slick-dotted"); |
| 902 |
|
| 903 |
_.unslicked = true; |
| 904 |
|
| 905 |
if (!refresh) { |
| 906 |
_.$slider.trigger("destroy", [_]); |
| 907 |
} |
| 908 |
}; |
| 909 |
|
| 910 |
Slick.prototype.disableTransition = function (slide) { |
| 911 |
var _ = this, |
| 912 |
transition = {}; |
| 913 |
|
| 914 |
transition[_.transitionType] = ""; |
| 915 |
|
| 916 |
if (_.options.fade === false) { |
| 917 |
_.$slideTrack.css(transition); |
| 918 |
} else { |
| 919 |
_.$slides.eq(slide).css(transition); |
| 920 |
} |
| 921 |
}; |
| 922 |
|
| 923 |
Slick.prototype.fadeSlide = function (slideIndex, callback) { |
| 924 |
var _ = this; |
| 925 |
|
| 926 |
if (_.cssTransitions === false) { |
| 927 |
_.$slides.eq(slideIndex).css({ |
| 928 |
zIndex: _.options.zIndex, |
| 929 |
}); |
| 930 |
|
| 931 |
_.$slides.eq(slideIndex).animate( |
| 932 |
{ |
| 933 |
opacity: 1, |
| 934 |
}, |
| 935 |
_.options.speed, |
| 936 |
_.options.easing, |
| 937 |
callback |
| 938 |
); |
| 939 |
} else { |
| 940 |
_.applyTransition(slideIndex); |
| 941 |
|
| 942 |
_.$slides.eq(slideIndex).css({ |
| 943 |
opacity: 1, |
| 944 |
zIndex: _.options.zIndex, |
| 945 |
}); |
| 946 |
|
| 947 |
if (callback) { |
| 948 |
setTimeout(function () { |
| 949 |
_.disableTransition(slideIndex); |
| 950 |
|
| 951 |
callback.call(); |
| 952 |
}, _.options.speed); |
| 953 |
} |
| 954 |
} |
| 955 |
}; |
| 956 |
|
| 957 |
Slick.prototype.fadeSlideOut = function (slideIndex) { |
| 958 |
var _ = this; |
| 959 |
|
| 960 |
if (_.cssTransitions === false) { |
| 961 |
_.$slides.eq(slideIndex).animate( |
| 962 |
{ |
| 963 |
opacity: 0, |
| 964 |
zIndex: _.options.zIndex - 2, |
| 965 |
}, |
| 966 |
_.options.speed, |
| 967 |
_.options.easing |
| 968 |
); |
| 969 |
} else { |
| 970 |
_.applyTransition(slideIndex); |
| 971 |
|
| 972 |
_.$slides.eq(slideIndex).css({ |
| 973 |
opacity: 0, |
| 974 |
zIndex: _.options.zIndex - 2, |
| 975 |
}); |
| 976 |
} |
| 977 |
}; |
| 978 |
|
| 979 |
Slick.prototype.filterSlides = Slick.prototype.slickFilter = function ( |
| 980 |
filter |
| 981 |
) { |
| 982 |
var _ = this; |
| 983 |
|
| 984 |
if (filter !== null) { |
| 985 |
_.$slidesCache = _.$slides; |
| 986 |
|
| 987 |
_.unload(); |
| 988 |
|
| 989 |
_.$slideTrack.children(this.options.slide).detach(); |
| 990 |
|
| 991 |
_.$slidesCache.filter(filter).appendTo(_.$slideTrack); |
| 992 |
|
| 993 |
_.reinit(); |
| 994 |
} |
| 995 |
}; |
| 996 |
|
| 997 |
Slick.prototype.focusHandler = function () { |
| 998 |
var _ = this; |
| 999 |
|
| 1000 |
// If any child element receives focus within the slider we need to pause the autoplay |
| 1001 |
_.$slider |
| 1002 |
.off("focus.slick blur.slick") |
| 1003 |
.on("focus.slick", "*", function (event) { |
| 1004 |
var $sf = $(this); |
| 1005 |
|
| 1006 |
setTimeout(function () { |
| 1007 |
if (_.options.pauseOnFocus) { |
| 1008 |
if ($sf.is(":focus")) { |
| 1009 |
_.focussed = true; |
| 1010 |
_.autoPlay(); |
| 1011 |
} |
| 1012 |
} |
| 1013 |
}, 0); |
| 1014 |
}) |
| 1015 |
.on("blur.slick", "*", function (event) { |
| 1016 |
var $sf = $(this); |
| 1017 |
|
| 1018 |
// When a blur occurs on any elements within the slider we become unfocused |
| 1019 |
if (_.options.pauseOnFocus) { |
| 1020 |
_.focussed = false; |
| 1021 |
_.autoPlay(); |
| 1022 |
} |
| 1023 |
}); |
| 1024 |
}; |
| 1025 |
|
| 1026 |
Slick.prototype.getCurrent = Slick.prototype.slickCurrentSlide = function () { |
| 1027 |
var _ = this; |
| 1028 |
return _.currentSlide; |
| 1029 |
}; |
| 1030 |
|
| 1031 |
Slick.prototype.getDotCount = function () { |
| 1032 |
var _ = this; |
| 1033 |
|
| 1034 |
var breakPoint = 0; |
| 1035 |
var counter = 0; |
| 1036 |
var pagerQty = 0; |
| 1037 |
|
| 1038 |
if (_.options.infinite === true) { |
| 1039 |
if (_.slideCount <= _.options.slidesToShow) { |
| 1040 |
++pagerQty; |
| 1041 |
} else { |
| 1042 |
while (breakPoint < _.slideCount) { |
| 1043 |
++pagerQty; |
| 1044 |
breakPoint = counter + _.options.slidesToScroll; |
| 1045 |
counter += |
| 1046 |
_.options.slidesToScroll <= _.options.slidesToShow |
| 1047 |
? _.options.slidesToScroll |
| 1048 |
: _.options.slidesToShow; |
| 1049 |
} |
| 1050 |
} |
| 1051 |
} else if (_.options.centerMode === true) { |
| 1052 |
pagerQty = _.slideCount; |
| 1053 |
} else if (!_.options.asNavFor) { |
| 1054 |
pagerQty = |
| 1055 |
1 + |
| 1056 |
Math.ceil( |
| 1057 |
(_.slideCount - _.options.slidesToShow) / _.options.slidesToScroll |
| 1058 |
); |
| 1059 |
} else { |
| 1060 |
while (breakPoint < _.slideCount) { |
| 1061 |
++pagerQty; |
| 1062 |
breakPoint = counter + _.options.slidesToScroll; |
| 1063 |
counter += |
| 1064 |
_.options.slidesToScroll <= _.options.slidesToShow |
| 1065 |
? _.options.slidesToScroll |
| 1066 |
: _.options.slidesToShow; |
| 1067 |
} |
| 1068 |
} |
| 1069 |
|
| 1070 |
return pagerQty - 1; |
| 1071 |
}; |
| 1072 |
|
| 1073 |
Slick.prototype.getLeft = function (slideIndex) { |
| 1074 |
var _ = this, |
| 1075 |
targetLeft, |
| 1076 |
verticalHeight, |
| 1077 |
verticalOffset = 0, |
| 1078 |
targetSlide, |
| 1079 |
coef; |
| 1080 |
|
| 1081 |
_.slideOffset = 0; |
| 1082 |
verticalHeight = _.$slides.first().outerHeight(true); |
| 1083 |
|
| 1084 |
if (_.options.infinite === true) { |
| 1085 |
if (_.slideCount > _.options.slidesToShow) { |
| 1086 |
_.slideOffset = _.slideWidth * _.options.slidesToShow * -1; |
| 1087 |
coef = -1; |
| 1088 |
|
| 1089 |
if (_.options.vertical === true && _.options.centerMode === true) { |
| 1090 |
if (_.options.slidesToShow === 2) { |
| 1091 |
coef = -1.5; |
| 1092 |
} else if (_.options.slidesToShow === 1) { |
| 1093 |
coef = -2; |
| 1094 |
} |
| 1095 |
} |
| 1096 |
verticalOffset = verticalHeight * _.options.slidesToShow * coef; |
| 1097 |
} |
| 1098 |
if (_.slideCount % _.options.slidesToScroll !== 0) { |
| 1099 |
if ( |
| 1100 |
slideIndex + _.options.slidesToScroll > _.slideCount && |
| 1101 |
_.slideCount > _.options.slidesToShow |
| 1102 |
) { |
| 1103 |
if (slideIndex > _.slideCount) { |
| 1104 |
_.slideOffset = |
| 1105 |
(_.options.slidesToShow - (slideIndex - _.slideCount)) * |
| 1106 |
_.slideWidth * |
| 1107 |
-1; |
| 1108 |
verticalOffset = |
| 1109 |
(_.options.slidesToShow - (slideIndex - _.slideCount)) * |
| 1110 |
verticalHeight * |
| 1111 |
-1; |
| 1112 |
} else { |
| 1113 |
_.slideOffset = |
| 1114 |
(_.slideCount % _.options.slidesToScroll) * _.slideWidth * -1; |
| 1115 |
verticalOffset = |
| 1116 |
(_.slideCount % _.options.slidesToScroll) * verticalHeight * -1; |
| 1117 |
} |
| 1118 |
} |
| 1119 |
} |
| 1120 |
} else { |
| 1121 |
if (slideIndex + _.options.slidesToShow > _.slideCount) { |
| 1122 |
_.slideOffset = |
| 1123 |
(slideIndex + _.options.slidesToShow - _.slideCount) * _.slideWidth; |
| 1124 |
verticalOffset = |
| 1125 |
(slideIndex + _.options.slidesToShow - _.slideCount) * verticalHeight; |
| 1126 |
} |
| 1127 |
} |
| 1128 |
|
| 1129 |
if (_.slideCount <= _.options.slidesToShow) { |
| 1130 |
_.slideOffset = 0; |
| 1131 |
verticalOffset = 0; |
| 1132 |
} |
| 1133 |
|
| 1134 |
if ( |
| 1135 |
_.options.centerMode === true && |
| 1136 |
_.slideCount <= _.options.slidesToShow |
| 1137 |
) { |
| 1138 |
_.slideOffset = |
| 1139 |
(_.slideWidth * Math.floor(_.options.slidesToShow)) / 2 - |
| 1140 |
(_.slideWidth * _.slideCount) / 2; |
| 1141 |
} else if (_.options.centerMode === true && _.options.infinite === true) { |
| 1142 |
_.slideOffset += |
| 1143 |
_.slideWidth * Math.floor(_.options.slidesToShow / 2) - _.slideWidth; |
| 1144 |
} else if (_.options.centerMode === true) { |
| 1145 |
_.slideOffset = 0; |
| 1146 |
_.slideOffset += _.slideWidth * Math.floor(_.options.slidesToShow / 2); |
| 1147 |
} |
| 1148 |
|
| 1149 |
if (_.options.vertical === false) { |
| 1150 |
targetLeft = slideIndex * _.slideWidth * -1 + _.slideOffset; |
| 1151 |
} else { |
| 1152 |
targetLeft = slideIndex * verticalHeight * -1 + verticalOffset; |
| 1153 |
} |
| 1154 |
|
| 1155 |
if (_.options.variableWidth === true) { |
| 1156 |
if ( |
| 1157 |
_.slideCount <= _.options.slidesToShow || |
| 1158 |
_.options.infinite === false |
| 1159 |
) { |
| 1160 |
targetSlide = _.$slideTrack.children(".slick-slide").eq(slideIndex); |
| 1161 |
} else { |
| 1162 |
targetSlide = _.$slideTrack |
| 1163 |
.children(".slick-slide") |
| 1164 |
.eq(slideIndex + _.options.slidesToShow); |
| 1165 |
} |
| 1166 |
|
| 1167 |
if (_.options.rtl === true) { |
| 1168 |
if (targetSlide[0]) { |
| 1169 |
targetLeft = |
| 1170 |
(_.$slideTrack.width() - |
| 1171 |
targetSlide[0].offsetLeft - |
| 1172 |
targetSlide.width()) * |
| 1173 |
-1; |
| 1174 |
} else { |
| 1175 |
targetLeft = 0; |
| 1176 |
} |
| 1177 |
} else { |
| 1178 |
targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; |
| 1179 |
} |
| 1180 |
|
| 1181 |
if (_.options.centerMode === true) { |
| 1182 |
if ( |
| 1183 |
_.slideCount <= _.options.slidesToShow || |
| 1184 |
_.options.infinite === false |
| 1185 |
) { |
| 1186 |
targetSlide = _.$slideTrack.children(".slick-slide").eq(slideIndex); |
| 1187 |
} else { |
| 1188 |
targetSlide = _.$slideTrack |
| 1189 |
.children(".slick-slide") |
| 1190 |
.eq(slideIndex + _.options.slidesToShow + 1); |
| 1191 |
} |
| 1192 |
|
| 1193 |
if (_.options.rtl === true) { |
| 1194 |
if (targetSlide[0]) { |
| 1195 |
targetLeft = |
| 1196 |
(_.$slideTrack.width() - |
| 1197 |
targetSlide[0].offsetLeft - |
| 1198 |
targetSlide.width()) * |
| 1199 |
-1; |
| 1200 |
} else { |
| 1201 |
targetLeft = 0; |
| 1202 |
} |
| 1203 |
} else { |
| 1204 |
targetLeft = targetSlide[0] ? targetSlide[0].offsetLeft * -1 : 0; |
| 1205 |
} |
| 1206 |
|
| 1207 |
targetLeft += (_.$list.width() - targetSlide.outerWidth()) / 2; |
| 1208 |
} |
| 1209 |
} |
| 1210 |
|
| 1211 |
return targetLeft; |
| 1212 |
}; |
| 1213 |
|
| 1214 |
Slick.prototype.getOption = Slick.prototype.slickGetOption = function ( |
| 1215 |
option |
| 1216 |
) { |
| 1217 |
var _ = this; |
| 1218 |
|
| 1219 |
return _.options[option]; |
| 1220 |
}; |
| 1221 |
|
| 1222 |
Slick.prototype.getNavigableIndexes = function () { |
| 1223 |
var _ = this, |
| 1224 |
breakPoint = 0, |
| 1225 |
counter = 0, |
| 1226 |
indexes = [], |
| 1227 |
max; |
| 1228 |
|
| 1229 |
if (_.options.infinite === false) { |
| 1230 |
max = _.slideCount; |
| 1231 |
} else { |
| 1232 |
breakPoint = _.options.slidesToScroll * -1; |
| 1233 |
counter = _.options.slidesToScroll * -1; |
| 1234 |
max = _.slideCount * 2; |
| 1235 |
} |
| 1236 |
|
| 1237 |
while (breakPoint < max) { |
| 1238 |
indexes.push(breakPoint); |
| 1239 |
breakPoint = counter + _.options.slidesToScroll; |
| 1240 |
counter += |
| 1241 |
_.options.slidesToScroll <= _.options.slidesToShow |
| 1242 |
? _.options.slidesToScroll |
| 1243 |
: _.options.slidesToShow; |
| 1244 |
} |
| 1245 |
|
| 1246 |
return indexes; |
| 1247 |
}; |
| 1248 |
|
| 1249 |
Slick.prototype.getSlick = function () { |
| 1250 |
return this; |
| 1251 |
}; |
| 1252 |
|
| 1253 |
Slick.prototype.getSlideCount = function () { |
| 1254 |
var _ = this, |
| 1255 |
slidesTraversed, |
| 1256 |
swipedSlide, |
| 1257 |
swipeTarget, |
| 1258 |
centerOffset; |
| 1259 |
|
| 1260 |
centerOffset = |
| 1261 |
_.options.centerMode === true ? Math.floor(_.$list.width() / 2) : 0; |
| 1262 |
swipeTarget = _.swipeLeft * -1 + centerOffset; |
| 1263 |
|
| 1264 |
if (_.options.swipeToSlide === true) { |
| 1265 |
_.$slideTrack.find(".slick-slide").each(function (index, slide) { |
| 1266 |
var slideOuterWidth, slideOffset, slideRightBoundary; |
| 1267 |
slideOuterWidth = $(slide).outerWidth(); |
| 1268 |
slideOffset = slide.offsetLeft; |
| 1269 |
if (_.options.centerMode !== true) { |
| 1270 |
slideOffset += slideOuterWidth / 2; |
| 1271 |
} |
| 1272 |
|
| 1273 |
slideRightBoundary = slideOffset + slideOuterWidth; |
| 1274 |
|
| 1275 |
if (swipeTarget < slideRightBoundary) { |
| 1276 |
swipedSlide = slide; |
| 1277 |
return false; |
| 1278 |
} |
| 1279 |
}); |
| 1280 |
|
| 1281 |
slidesTraversed = |
| 1282 |
Math.abs($(swipedSlide).attr("data-slick-index") - _.currentSlide) || 1; |
| 1283 |
|
| 1284 |
return slidesTraversed; |
| 1285 |
} else { |
| 1286 |
return _.options.slidesToScroll; |
| 1287 |
} |
| 1288 |
}; |
| 1289 |
|
| 1290 |
Slick.prototype.goTo = Slick.prototype.slickGoTo = function ( |
| 1291 |
slide, |
| 1292 |
dontAnimate |
| 1293 |
) { |
| 1294 |
var _ = this; |
| 1295 |
|
| 1296 |
_.changeSlide( |
| 1297 |
{ |
| 1298 |
data: { |
| 1299 |
message: "index", |
| 1300 |
index: parseInt(slide), |
| 1301 |
}, |
| 1302 |
}, |
| 1303 |
dontAnimate |
| 1304 |
); |
| 1305 |
}; |
| 1306 |
|
| 1307 |
Slick.prototype.init = function (creation) { |
| 1308 |
var _ = this; |
| 1309 |
|
| 1310 |
if (!$(_.$slider).hasClass("slick-initialized")) { |
| 1311 |
$(_.$slider).addClass("slick-initialized"); |
| 1312 |
|
| 1313 |
_.buildRows(); |
| 1314 |
_.buildOut(); |
| 1315 |
_.setProps(); |
| 1316 |
_.startLoad(); |
| 1317 |
_.loadSlider(); |
| 1318 |
_.initializeEvents(); |
| 1319 |
_.updateArrows(); |
| 1320 |
_.updateDots(); |
| 1321 |
_.checkResponsive(true); |
| 1322 |
_.focusHandler(); |
| 1323 |
} |
| 1324 |
|
| 1325 |
if (creation) { |
| 1326 |
_.$slider.trigger("init", [_]); |
| 1327 |
} |
| 1328 |
|
| 1329 |
if (_.options.accessibility === true) { |
| 1330 |
_.initADA(); |
| 1331 |
} |
| 1332 |
|
| 1333 |
if (_.options.autoplay) { |
| 1334 |
_.paused = false; |
| 1335 |
_.autoPlay(); |
| 1336 |
} |
| 1337 |
}; |
| 1338 |
|
| 1339 |
Slick.prototype.initADA = function () { |
| 1340 |
var _ = this, |
| 1341 |
numDotGroups = Math.ceil(_.slideCount / _.options.slidesToShow), |
| 1342 |
tabControlIndexes = _.getNavigableIndexes().filter(function (val) { |
| 1343 |
return val >= 0 && val < _.slideCount; |
| 1344 |
}); |
| 1345 |
|
| 1346 |
_.$slides |
| 1347 |
.add(_.$slideTrack.find(".slick-cloned")) |
| 1348 |
.attr({ |
| 1349 |
"aria-hidden": "true", |
| 1350 |
tabindex: "-1", |
| 1351 |
}) |
| 1352 |
.find("a, input, button, select") |
| 1353 |
.attr({ |
| 1354 |
tabindex: "-1", |
| 1355 |
}); |
| 1356 |
|
| 1357 |
if (_.$dots !== null) { |
| 1358 |
_.$slides.not(_.$slideTrack.find(".slick-cloned")).each(function (i) { |
| 1359 |
var slideControlIndex = tabControlIndexes.indexOf(i); |
| 1360 |
|
| 1361 |
$(this).attr({ |
| 1362 |
role: "tabpanel", |
| 1363 |
id: "slick-slide" + _.instanceUid + i, |
| 1364 |
tabindex: -1, |
| 1365 |
}); |
| 1366 |
|
| 1367 |
if (slideControlIndex !== -1) { |
| 1368 |
var ariaButtonControl = |
| 1369 |
"slick-slide-control" + _.instanceUid + slideControlIndex; |
| 1370 |
if ($("#" + ariaButtonControl).length) { |
| 1371 |
$(this).attr({ |
| 1372 |
"aria-describedby": ariaButtonControl, |
| 1373 |
}); |
| 1374 |
} |
| 1375 |
} |
| 1376 |
}); |
| 1377 |
|
| 1378 |
_.$dots |
| 1379 |
.attr("role", "tablist") |
| 1380 |
.find("li") |
| 1381 |
.each(function (i) { |
| 1382 |
var mappedSlideIndex = tabControlIndexes[i]; |
| 1383 |
|
| 1384 |
$(this).attr({ |
| 1385 |
role: "presentation", |
| 1386 |
}); |
| 1387 |
|
| 1388 |
$(this) |
| 1389 |
.find("button") |
| 1390 |
.first() |
| 1391 |
.attr({ |
| 1392 |
role: "tab", |
| 1393 |
id: "slick-slide-control" + _.instanceUid + i, |
| 1394 |
"aria-controls": "slick-slide" + _.instanceUid + mappedSlideIndex, |
| 1395 |
"aria-label": i + 1 + " of " + numDotGroups, |
| 1396 |
"aria-selected": null, |
| 1397 |
tabindex: "-1", |
| 1398 |
}); |
| 1399 |
}) |
| 1400 |
.eq(_.currentSlide) |
| 1401 |
.find("button") |
| 1402 |
.attr({ |
| 1403 |
"aria-selected": "true", |
| 1404 |
tabindex: "0", |
| 1405 |
}) |
| 1406 |
.end(); |
| 1407 |
} |
| 1408 |
|
| 1409 |
for ( |
| 1410 |
var i = _.currentSlide, max = i + _.options.slidesToShow; |
| 1411 |
i < max; |
| 1412 |
i++ |
| 1413 |
) { |
| 1414 |
if (_.options.focusOnChange) { |
| 1415 |
_.$slides.eq(i).attr({ tabindex: "0" }); |
| 1416 |
} else { |
| 1417 |
_.$slides.eq(i).removeAttr("tabindex"); |
| 1418 |
} |
| 1419 |
} |
| 1420 |
|
| 1421 |
_.activateADA(); |
| 1422 |
}; |
| 1423 |
|
| 1424 |
Slick.prototype.initArrowEvents = function () { |
| 1425 |
var _ = this; |
| 1426 |
|
| 1427 |
if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { |
| 1428 |
_.$prevArrow.off("click.slick").on( |
| 1429 |
"click.slick", |
| 1430 |
{ |
| 1431 |
message: "previous", |
| 1432 |
}, |
| 1433 |
_.changeSlide |
| 1434 |
); |
| 1435 |
_.$nextArrow.off("click.slick").on( |
| 1436 |
"click.slick", |
| 1437 |
{ |
| 1438 |
message: "next", |
| 1439 |
}, |
| 1440 |
_.changeSlide |
| 1441 |
); |
| 1442 |
|
| 1443 |
if (_.options.accessibility === true) { |
| 1444 |
_.$prevArrow.on("keydown.slick", _.keyHandler); |
| 1445 |
_.$nextArrow.on("keydown.slick", _.keyHandler); |
| 1446 |
} |
| 1447 |
} |
| 1448 |
}; |
| 1449 |
|
| 1450 |
Slick.prototype.initDotEvents = function () { |
| 1451 |
var _ = this; |
| 1452 |
|
| 1453 |
if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { |
| 1454 |
$("li", _.$dots).on( |
| 1455 |
"click.slick", |
| 1456 |
{ |
| 1457 |
message: "index", |
| 1458 |
}, |
| 1459 |
_.changeSlide |
| 1460 |
); |
| 1461 |
|
| 1462 |
if (_.options.accessibility === true) { |
| 1463 |
_.$dots.on("keydown.slick", _.keyHandler); |
| 1464 |
} |
| 1465 |
} |
| 1466 |
|
| 1467 |
if ( |
| 1468 |
_.options.dots === true && |
| 1469 |
_.options.pauseOnDotsHover === true && |
| 1470 |
_.slideCount > _.options.slidesToShow |
| 1471 |
) { |
| 1472 |
$("li", _.$dots) |
| 1473 |
.on("mouseenter.slick", $.proxy(_.interrupt, _, true)) |
| 1474 |
.on("mouseleave.slick", $.proxy(_.interrupt, _, false)); |
| 1475 |
} |
| 1476 |
}; |
| 1477 |
|
| 1478 |
Slick.prototype.initSlideEvents = function () { |
| 1479 |
var _ = this; |
| 1480 |
|
| 1481 |
if (_.options.pauseOnHover) { |
| 1482 |
_.$list.on("mouseenter.slick", $.proxy(_.interrupt, _, true)); |
| 1483 |
_.$list.on("mouseleave.slick", $.proxy(_.interrupt, _, false)); |
| 1484 |
} |
| 1485 |
}; |
| 1486 |
|
| 1487 |
Slick.prototype.initializeEvents = function () { |
| 1488 |
var _ = this; |
| 1489 |
|
| 1490 |
_.initArrowEvents(); |
| 1491 |
|
| 1492 |
_.initDotEvents(); |
| 1493 |
_.initSlideEvents(); |
| 1494 |
|
| 1495 |
_.$list.on( |
| 1496 |
"touchstart.slick mousedown.slick", |
| 1497 |
{ |
| 1498 |
action: "start", |
| 1499 |
}, |
| 1500 |
_.swipeHandler |
| 1501 |
); |
| 1502 |
_.$list.on( |
| 1503 |
"touchmove.slick mousemove.slick", |
| 1504 |
{ |
| 1505 |
action: "move", |
| 1506 |
}, |
| 1507 |
_.swipeHandler |
| 1508 |
); |
| 1509 |
_.$list.on( |
| 1510 |
"touchend.slick mouseup.slick", |
| 1511 |
{ |
| 1512 |
action: "end", |
| 1513 |
}, |
| 1514 |
_.swipeHandler |
| 1515 |
); |
| 1516 |
_.$list.on( |
| 1517 |
"touchcancel.slick mouseleave.slick", |
| 1518 |
{ |
| 1519 |
action: "end", |
| 1520 |
}, |
| 1521 |
_.swipeHandler |
| 1522 |
); |
| 1523 |
|
| 1524 |
_.$list.on("click.slick", _.clickHandler); |
| 1525 |
|
| 1526 |
$(document).on(_.visibilityChange, $.proxy(_.visibility, _)); |
| 1527 |
|
| 1528 |
if (_.options.accessibility === true) { |
| 1529 |
_.$list.on("keydown.slick", _.keyHandler); |
| 1530 |
} |
| 1531 |
|
| 1532 |
if (_.options.focusOnSelect === true) { |
| 1533 |
$(_.$slideTrack).children().on("click.slick", _.selectHandler); |
| 1534 |
} |
| 1535 |
|
| 1536 |
$(window).on( |
| 1537 |
"orientationchange.slick.slick-" + _.instanceUid, |
| 1538 |
$.proxy(_.orientationChange, _) |
| 1539 |
); |
| 1540 |
|
| 1541 |
$(window).on("resize.slick.slick-" + _.instanceUid, $.proxy(_.resize, _)); |
| 1542 |
|
| 1543 |
$("[draggable!=true]", _.$slideTrack).on("dragstart", _.preventDefault); |
| 1544 |
|
| 1545 |
$(window).on("load.slick.slick-" + _.instanceUid, _.setPosition); |
| 1546 |
$(_.setPosition); |
| 1547 |
}; |
| 1548 |
|
| 1549 |
Slick.prototype.initUI = function () { |
| 1550 |
var _ = this; |
| 1551 |
|
| 1552 |
if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { |
| 1553 |
_.$prevArrow.show(); |
| 1554 |
_.$nextArrow.show(); |
| 1555 |
} |
| 1556 |
|
| 1557 |
if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { |
| 1558 |
_.$dots.show(); |
| 1559 |
} |
| 1560 |
}; |
| 1561 |
|
| 1562 |
Slick.prototype.keyHandler = function (event) { |
| 1563 |
var _ = this; |
| 1564 |
// Dont slide if the cursor is inside the form fields and arrow keys are pressed |
| 1565 |
if (!event.target.tagName.match("TEXTAREA|INPUT|SELECT")) { |
| 1566 |
if (event.keyCode === 37 && _.options.accessibility === true) { |
| 1567 |
_.changeSlide({ |
| 1568 |
data: { |
| 1569 |
message: _.options.rtl === true ? "next" : "previous", |
| 1570 |
}, |
| 1571 |
}); |
| 1572 |
} else if (event.keyCode === 39 && _.options.accessibility === true) { |
| 1573 |
_.changeSlide({ |
| 1574 |
data: { |
| 1575 |
message: _.options.rtl === true ? "previous" : "next", |
| 1576 |
}, |
| 1577 |
}); |
| 1578 |
} |
| 1579 |
} |
| 1580 |
}; |
| 1581 |
|
| 1582 |
Slick.prototype.lazyLoad = function () { |
| 1583 |
var _ = this, |
| 1584 |
loadRange, |
| 1585 |
cloneRange, |
| 1586 |
rangeStart, |
| 1587 |
rangeEnd; |
| 1588 |
|
| 1589 |
function loadImages(imagesScope) { |
| 1590 |
$("img[data-lazy]", imagesScope).each(function () { |
| 1591 |
var image = $(this), |
| 1592 |
imageSource = $(this).attr("data-lazy"), |
| 1593 |
imageSrcSet = $(this).attr("data-srcset"), |
| 1594 |
imageSizes = |
| 1595 |
$(this).attr("data-sizes") || _.$slider.attr("data-sizes"), |
| 1596 |
imageToLoad = document.createElement("img"); |
| 1597 |
|
| 1598 |
imageToLoad.onload = function () { |
| 1599 |
image.animate({ opacity: 0 }, 100, function () { |
| 1600 |
if (imageSrcSet) { |
| 1601 |
image.attr("srcset", imageSrcSet); |
| 1602 |
|
| 1603 |
if (imageSizes) { |
| 1604 |
image.attr("sizes", imageSizes); |
| 1605 |
} |
| 1606 |
} |
| 1607 |
|
| 1608 |
image |
| 1609 |
.attr("src", imageSource) |
| 1610 |
.animate({ opacity: 1 }, 200, function () { |
| 1611 |
image |
| 1612 |
.removeAttr("data-lazy data-srcset data-sizes") |
| 1613 |
.removeClass("slick-loading"); |
| 1614 |
}); |
| 1615 |
_.$slider.trigger("lazyLoaded", [_, image, imageSource]); |
| 1616 |
}); |
| 1617 |
}; |
| 1618 |
|
| 1619 |
imageToLoad.onerror = function () { |
| 1620 |
image |
| 1621 |
.removeAttr("data-lazy") |
| 1622 |
.removeClass("slick-loading") |
| 1623 |
.addClass("slick-lazyload-error"); |
| 1624 |
|
| 1625 |
_.$slider.trigger("lazyLoadError", [_, image, imageSource]); |
| 1626 |
}; |
| 1627 |
|
| 1628 |
imageToLoad.src = imageSource; |
| 1629 |
}); |
| 1630 |
} |
| 1631 |
|
| 1632 |
if (_.options.centerMode === true) { |
| 1633 |
if (_.options.infinite === true) { |
| 1634 |
rangeStart = _.currentSlide + (_.options.slidesToShow / 2 + 1); |
| 1635 |
rangeEnd = rangeStart + _.options.slidesToShow + 2; |
| 1636 |
} else { |
| 1637 |
rangeStart = Math.max( |
| 1638 |
0, |
| 1639 |
_.currentSlide - (_.options.slidesToShow / 2 + 1) |
| 1640 |
); |
| 1641 |
rangeEnd = 2 + (_.options.slidesToShow / 2 + 1) + _.currentSlide; |
| 1642 |
} |
| 1643 |
} else { |
| 1644 |
rangeStart = _.options.infinite |
| 1645 |
? _.options.slidesToShow + _.currentSlide |
| 1646 |
: _.currentSlide; |
| 1647 |
rangeEnd = Math.ceil(rangeStart + _.options.slidesToShow); |
| 1648 |
if (_.options.fade === true) { |
| 1649 |
if (rangeStart > 0) { |
| 1650 |
rangeStart--; |
| 1651 |
} |
| 1652 |
if (rangeEnd <= _.slideCount) { |
| 1653 |
rangeEnd++; |
| 1654 |
} |
| 1655 |
} |
| 1656 |
} |
| 1657 |
|
| 1658 |
loadRange = _.$slider.find(".slick-slide").slice(rangeStart, rangeEnd); |
| 1659 |
|
| 1660 |
if (_.options.lazyLoad === "anticipated") { |
| 1661 |
var prevSlide = rangeStart - 1, |
| 1662 |
nextSlide = rangeEnd, |
| 1663 |
$slides = _.$slider.find(".slick-slide"); |
| 1664 |
|
| 1665 |
for (var i = 0; i < _.options.slidesToScroll; i++) { |
| 1666 |
if (prevSlide < 0) { |
| 1667 |
prevSlide = _.slideCount - 1; |
| 1668 |
} |
| 1669 |
loadRange = loadRange.add($slides.eq(prevSlide)); |
| 1670 |
loadRange = loadRange.add($slides.eq(nextSlide)); |
| 1671 |
prevSlide--; |
| 1672 |
nextSlide++; |
| 1673 |
} |
| 1674 |
} |
| 1675 |
|
| 1676 |
loadImages(loadRange); |
| 1677 |
|
| 1678 |
if (_.slideCount <= _.options.slidesToShow) { |
| 1679 |
cloneRange = _.$slider.find(".slick-slide"); |
| 1680 |
loadImages(cloneRange); |
| 1681 |
} else if (_.currentSlide >= _.slideCount - _.options.slidesToShow) { |
| 1682 |
cloneRange = _.$slider |
| 1683 |
.find(".slick-cloned") |
| 1684 |
.slice(0, _.options.slidesToShow); |
| 1685 |
loadImages(cloneRange); |
| 1686 |
} else if (_.currentSlide === 0) { |
| 1687 |
cloneRange = _.$slider |
| 1688 |
.find(".slick-cloned") |
| 1689 |
.slice(_.options.slidesToShow * -1); |
| 1690 |
loadImages(cloneRange); |
| 1691 |
} |
| 1692 |
}; |
| 1693 |
|
| 1694 |
Slick.prototype.loadSlider = function () { |
| 1695 |
var _ = this; |
| 1696 |
|
| 1697 |
_.setPosition(); |
| 1698 |
|
| 1699 |
_.$slideTrack.css({ |
| 1700 |
opacity: 1, |
| 1701 |
}); |
| 1702 |
|
| 1703 |
_.$slider.removeClass("slick-loading"); |
| 1704 |
|
| 1705 |
_.initUI(); |
| 1706 |
|
| 1707 |
if (_.options.lazyLoad === "progressive") { |
| 1708 |
_.progressiveLazyLoad(); |
| 1709 |
} |
| 1710 |
}; |
| 1711 |
|
| 1712 |
Slick.prototype.next = Slick.prototype.slickNext = function () { |
| 1713 |
var _ = this; |
| 1714 |
|
| 1715 |
_.changeSlide({ |
| 1716 |
data: { |
| 1717 |
message: "next", |
| 1718 |
}, |
| 1719 |
}); |
| 1720 |
}; |
| 1721 |
|
| 1722 |
Slick.prototype.orientationChange = function () { |
| 1723 |
var _ = this; |
| 1724 |
|
| 1725 |
_.checkResponsive(); |
| 1726 |
_.setPosition(); |
| 1727 |
}; |
| 1728 |
|
| 1729 |
Slick.prototype.pause = Slick.prototype.slickPause = function () { |
| 1730 |
var _ = this; |
| 1731 |
|
| 1732 |
_.autoPlayClear(); |
| 1733 |
_.paused = true; |
| 1734 |
}; |
| 1735 |
|
| 1736 |
Slick.prototype.play = Slick.prototype.slickPlay = function () { |
| 1737 |
var _ = this; |
| 1738 |
|
| 1739 |
_.autoPlay(); |
| 1740 |
_.options.autoplay = true; |
| 1741 |
_.paused = false; |
| 1742 |
_.focussed = false; |
| 1743 |
_.interrupted = false; |
| 1744 |
}; |
| 1745 |
|
| 1746 |
Slick.prototype.postSlide = function (index) { |
| 1747 |
var _ = this; |
| 1748 |
|
| 1749 |
if (!_.unslicked) { |
| 1750 |
_.$slider.trigger("afterChange", [_, index]); |
| 1751 |
|
| 1752 |
_.animating = false; |
| 1753 |
|
| 1754 |
if (_.slideCount > _.options.slidesToShow) { |
| 1755 |
_.setPosition(); |
| 1756 |
} |
| 1757 |
|
| 1758 |
_.swipeLeft = null; |
| 1759 |
|
| 1760 |
if (_.options.autoplay) { |
| 1761 |
_.autoPlay(); |
| 1762 |
} |
| 1763 |
|
| 1764 |
if (_.options.accessibility === true) { |
| 1765 |
_.initADA(); |
| 1766 |
|
| 1767 |
if (_.options.focusOnChange) { |
| 1768 |
var $currentSlide = $(_.$slides.get(_.currentSlide)); |
| 1769 |
$currentSlide.attr("tabindex", 0).focus(); |
| 1770 |
} |
| 1771 |
} |
| 1772 |
} |
| 1773 |
}; |
| 1774 |
|
| 1775 |
Slick.prototype.prev = Slick.prototype.slickPrev = function () { |
| 1776 |
var _ = this; |
| 1777 |
|
| 1778 |
_.changeSlide({ |
| 1779 |
data: { |
| 1780 |
message: "previous", |
| 1781 |
}, |
| 1782 |
}); |
| 1783 |
}; |
| 1784 |
|
| 1785 |
Slick.prototype.preventDefault = function (event) { |
| 1786 |
event.preventDefault(); |
| 1787 |
}; |
| 1788 |
|
| 1789 |
Slick.prototype.progressiveLazyLoad = function (tryCount) { |
| 1790 |
tryCount = tryCount || 1; |
| 1791 |
|
| 1792 |
var _ = this, |
| 1793 |
$imgsToLoad = $("img[data-lazy]", _.$slider), |
| 1794 |
image, |
| 1795 |
imageSource, |
| 1796 |
imageSrcSet, |
| 1797 |
imageSizes, |
| 1798 |
imageToLoad; |
| 1799 |
|
| 1800 |
if ($imgsToLoad.length) { |
| 1801 |
image = $imgsToLoad.first(); |
| 1802 |
imageSource = image.attr("data-lazy"); |
| 1803 |
imageSrcSet = image.attr("data-srcset"); |
| 1804 |
imageSizes = image.attr("data-sizes") || _.$slider.attr("data-sizes"); |
| 1805 |
imageToLoad = document.createElement("img"); |
| 1806 |
|
| 1807 |
imageToLoad.onload = function () { |
| 1808 |
if (imageSrcSet) { |
| 1809 |
image.attr("srcset", imageSrcSet); |
| 1810 |
|
| 1811 |
if (imageSizes) { |
| 1812 |
image.attr("sizes", imageSizes); |
| 1813 |
} |
| 1814 |
} |
| 1815 |
|
| 1816 |
image |
| 1817 |
.attr("src", imageSource) |
| 1818 |
.removeAttr("data-lazy data-srcset data-sizes") |
| 1819 |
.removeClass("slick-loading"); |
| 1820 |
|
| 1821 |
if (_.options.adaptiveHeight === true) { |
| 1822 |
_.setPosition(); |
| 1823 |
} |
| 1824 |
|
| 1825 |
_.$slider.trigger("lazyLoaded", [_, image, imageSource]); |
| 1826 |
_.progressiveLazyLoad(); |
| 1827 |
}; |
| 1828 |
|
| 1829 |
imageToLoad.onerror = function () { |
| 1830 |
if (tryCount < 3) { |
| 1831 |
/** |
| 1832 |
* try to load the image 3 times, |
| 1833 |
* leave a slight delay so we don't get |
| 1834 |
* servers blocking the request. |
| 1835 |
*/ |
| 1836 |
setTimeout(function () { |
| 1837 |
_.progressiveLazyLoad(tryCount + 1); |
| 1838 |
}, 500); |
| 1839 |
} else { |
| 1840 |
image |
| 1841 |
.removeAttr("data-lazy") |
| 1842 |
.removeClass("slick-loading") |
| 1843 |
.addClass("slick-lazyload-error"); |
| 1844 |
|
| 1845 |
_.$slider.trigger("lazyLoadError", [_, image, imageSource]); |
| 1846 |
|
| 1847 |
_.progressiveLazyLoad(); |
| 1848 |
} |
| 1849 |
}; |
| 1850 |
|
| 1851 |
imageToLoad.src = imageSource; |
| 1852 |
} else { |
| 1853 |
_.$slider.trigger("allImagesLoaded", [_]); |
| 1854 |
} |
| 1855 |
}; |
| 1856 |
|
| 1857 |
Slick.prototype.refresh = function (initializing) { |
| 1858 |
var _ = this, |
| 1859 |
currentSlide, |
| 1860 |
lastVisibleIndex; |
| 1861 |
|
| 1862 |
lastVisibleIndex = _.slideCount - _.options.slidesToShow; |
| 1863 |
|
| 1864 |
// in non-infinite sliders, we don't want to go past the |
| 1865 |
// last visible index. |
| 1866 |
if (!_.options.infinite && _.currentSlide > lastVisibleIndex) { |
| 1867 |
_.currentSlide = lastVisibleIndex; |
| 1868 |
} |
| 1869 |
|
| 1870 |
// if less slides than to show, go to start. |
| 1871 |
if (_.slideCount <= _.options.slidesToShow) { |
| 1872 |
_.currentSlide = 0; |
| 1873 |
} |
| 1874 |
|
| 1875 |
currentSlide = _.currentSlide; |
| 1876 |
|
| 1877 |
_.destroy(true); |
| 1878 |
|
| 1879 |
$.extend(_, _.initials, { currentSlide: currentSlide }); |
| 1880 |
|
| 1881 |
_.init(); |
| 1882 |
|
| 1883 |
if (!initializing) { |
| 1884 |
_.changeSlide( |
| 1885 |
{ |
| 1886 |
data: { |
| 1887 |
message: "index", |
| 1888 |
index: currentSlide, |
| 1889 |
}, |
| 1890 |
}, |
| 1891 |
false |
| 1892 |
); |
| 1893 |
} |
| 1894 |
}; |
| 1895 |
|
| 1896 |
Slick.prototype.registerBreakpoints = function () { |
| 1897 |
var _ = this, |
| 1898 |
breakpoint, |
| 1899 |
currentBreakpoint, |
| 1900 |
l, |
| 1901 |
responsiveSettings = _.options.responsive || null; |
| 1902 |
|
| 1903 |
if ($.type(responsiveSettings) === "array" && responsiveSettings.length) { |
| 1904 |
_.respondTo = _.options.respondTo || "window"; |
| 1905 |
|
| 1906 |
for (breakpoint in responsiveSettings) { |
| 1907 |
l = _.breakpoints.length - 1; |
| 1908 |
|
| 1909 |
if (responsiveSettings.hasOwnProperty(breakpoint)) { |
| 1910 |
currentBreakpoint = responsiveSettings[breakpoint].breakpoint; |
| 1911 |
|
| 1912 |
// loop through the breakpoints and cut out any existing |
| 1913 |
// ones with the same breakpoint number, we don't want dupes. |
| 1914 |
while (l >= 0) { |
| 1915 |
if (_.breakpoints[l] && _.breakpoints[l] === currentBreakpoint) { |
| 1916 |
_.breakpoints.splice(l, 1); |
| 1917 |
} |
| 1918 |
l--; |
| 1919 |
} |
| 1920 |
|
| 1921 |
_.breakpoints.push(currentBreakpoint); |
| 1922 |
_.breakpointSettings[currentBreakpoint] = |
| 1923 |
responsiveSettings[breakpoint].settings; |
| 1924 |
} |
| 1925 |
} |
| 1926 |
|
| 1927 |
_.breakpoints.sort(function (a, b) { |
| 1928 |
return _.options.mobileFirst ? a - b : b - a; |
| 1929 |
}); |
| 1930 |
} |
| 1931 |
}; |
| 1932 |
|
| 1933 |
Slick.prototype.reinit = function () { |
| 1934 |
var _ = this; |
| 1935 |
|
| 1936 |
_.$slides = _.$slideTrack.children(_.options.slide).addClass("slick-slide"); |
| 1937 |
|
| 1938 |
_.slideCount = _.$slides.length; |
| 1939 |
|
| 1940 |
if (_.currentSlide >= _.slideCount && _.currentSlide !== 0) { |
| 1941 |
_.currentSlide = _.currentSlide - _.options.slidesToScroll; |
| 1942 |
} |
| 1943 |
|
| 1944 |
if (_.slideCount <= _.options.slidesToShow) { |
| 1945 |
_.currentSlide = 0; |
| 1946 |
} |
| 1947 |
|
| 1948 |
_.registerBreakpoints(); |
| 1949 |
|
| 1950 |
_.setProps(); |
| 1951 |
_.setupInfinite(); |
| 1952 |
_.buildArrows(); |
| 1953 |
_.updateArrows(); |
| 1954 |
_.initArrowEvents(); |
| 1955 |
_.buildDots(); |
| 1956 |
_.updateDots(); |
| 1957 |
_.initDotEvents(); |
| 1958 |
_.cleanUpSlideEvents(); |
| 1959 |
_.initSlideEvents(); |
| 1960 |
|
| 1961 |
_.checkResponsive(false, true); |
| 1962 |
|
| 1963 |
if (_.options.focusOnSelect === true) { |
| 1964 |
$(_.$slideTrack).children().on("click.slick", _.selectHandler); |
| 1965 |
} |
| 1966 |
|
| 1967 |
_.setSlideClasses(typeof _.currentSlide === "number" ? _.currentSlide : 0); |
| 1968 |
|
| 1969 |
_.setPosition(); |
| 1970 |
_.focusHandler(); |
| 1971 |
|
| 1972 |
_.paused = !_.options.autoplay; |
| 1973 |
_.autoPlay(); |
| 1974 |
|
| 1975 |
_.$slider.trigger("reInit", [_]); |
| 1976 |
}; |
| 1977 |
|
| 1978 |
Slick.prototype.resize = function () { |
| 1979 |
var _ = this; |
| 1980 |
|
| 1981 |
if ($(window).width() !== _.windowWidth) { |
| 1982 |
clearTimeout(_.windowDelay); |
| 1983 |
_.windowDelay = window.setTimeout(function () { |
| 1984 |
_.windowWidth = $(window).width(); |
| 1985 |
_.checkResponsive(); |
| 1986 |
if (!_.unslicked) { |
| 1987 |
_.setPosition(); |
| 1988 |
} |
| 1989 |
}, 50); |
| 1990 |
} |
| 1991 |
}; |
| 1992 |
|
| 1993 |
Slick.prototype.removeSlide = Slick.prototype.slickRemove = function ( |
| 1994 |
index, |
| 1995 |
removeBefore, |
| 1996 |
removeAll |
| 1997 |
) { |
| 1998 |
var _ = this; |
| 1999 |
|
| 2000 |
if (typeof index === "boolean") { |
| 2001 |
removeBefore = index; |
| 2002 |
index = removeBefore === true ? 0 : _.slideCount - 1; |
| 2003 |
} else { |
| 2004 |
index = removeBefore === true ? --index : index; |
| 2005 |
} |
| 2006 |
|
| 2007 |
if (_.slideCount < 1 || index < 0 || index > _.slideCount - 1) { |
| 2008 |
return false; |
| 2009 |
} |
| 2010 |
|
| 2011 |
_.unload(); |
| 2012 |
|
| 2013 |
if (removeAll === true) { |
| 2014 |
_.$slideTrack.children().remove(); |
| 2015 |
} else { |
| 2016 |
_.$slideTrack.children(this.options.slide).eq(index).remove(); |
| 2017 |
} |
| 2018 |
|
| 2019 |
_.$slides = _.$slideTrack.children(this.options.slide); |
| 2020 |
|
| 2021 |
_.$slideTrack.children(this.options.slide).detach(); |
| 2022 |
|
| 2023 |
_.$slideTrack.append(_.$slides); |
| 2024 |
|
| 2025 |
_.$slidesCache = _.$slides; |
| 2026 |
|
| 2027 |
_.reinit(); |
| 2028 |
}; |
| 2029 |
|
| 2030 |
Slick.prototype.setCSS = function (position) { |
| 2031 |
var _ = this, |
| 2032 |
positionProps = {}, |
| 2033 |
x, |
| 2034 |
y; |
| 2035 |
|
| 2036 |
if (_.options.rtl === true) { |
| 2037 |
position = -position; |
| 2038 |
} |
| 2039 |
x = _.positionProp == "left" ? Math.ceil(position) + "px" : "0px"; |
| 2040 |
y = _.positionProp == "top" ? Math.ceil(position) + "px" : "0px"; |
| 2041 |
|
| 2042 |
positionProps[_.positionProp] = position; |
| 2043 |
|
| 2044 |
if (_.transformsEnabled === false) { |
| 2045 |
_.$slideTrack.css(positionProps); |
| 2046 |
} else { |
| 2047 |
positionProps = {}; |
| 2048 |
if (_.cssTransitions === false) { |
| 2049 |
positionProps[_.animType] = "translate(" + x + ", " + y + ")"; |
| 2050 |
_.$slideTrack.css(positionProps); |
| 2051 |
} else { |
| 2052 |
positionProps[_.animType] = "translate3d(" + x + ", " + y + ", 0px)"; |
| 2053 |
_.$slideTrack.css(positionProps); |
| 2054 |
} |
| 2055 |
} |
| 2056 |
}; |
| 2057 |
|
| 2058 |
Slick.prototype.setDimensions = function () { |
| 2059 |
var _ = this; |
| 2060 |
|
| 2061 |
if (_.options.vertical === false) { |
| 2062 |
if (_.options.centerMode === true) { |
| 2063 |
_.$list.css({ |
| 2064 |
padding: "0px " + _.options.centerPadding, |
| 2065 |
}); |
| 2066 |
} |
| 2067 |
} else { |
| 2068 |
_.$list.height( |
| 2069 |
_.$slides.first().outerHeight(true) * _.options.slidesToShow |
| 2070 |
); |
| 2071 |
if (_.options.centerMode === true) { |
| 2072 |
_.$list.css({ |
| 2073 |
padding: _.options.centerPadding + " 0px", |
| 2074 |
}); |
| 2075 |
} |
| 2076 |
} |
| 2077 |
|
| 2078 |
_.listWidth = _.$list.width(); |
| 2079 |
_.listHeight = _.$list.height(); |
| 2080 |
|
| 2081 |
if (_.options.vertical === false && _.options.variableWidth === false) { |
| 2082 |
_.slideWidth = Math.ceil(_.listWidth / _.options.slidesToShow); |
| 2083 |
_.$slideTrack.width( |
| 2084 |
Math.ceil(_.slideWidth * _.$slideTrack.children(".slick-slide").length) |
| 2085 |
); |
| 2086 |
} else if (_.options.variableWidth === true) { |
| 2087 |
_.$slideTrack.width(5000 * _.slideCount); |
| 2088 |
} else { |
| 2089 |
_.slideWidth = Math.ceil(_.listWidth); |
| 2090 |
_.$slideTrack.height( |
| 2091 |
Math.ceil( |
| 2092 |
_.$slides.first().outerHeight(true) * |
| 2093 |
_.$slideTrack.children(".slick-slide").length |
| 2094 |
) |
| 2095 |
); |
| 2096 |
} |
| 2097 |
|
| 2098 |
var offset = _.$slides.first().outerWidth(true) - _.$slides.first().width(); |
| 2099 |
if (_.options.variableWidth === false) { |
| 2100 |
_.$slideTrack.children(".slick-slide").width(_.slideWidth - offset); |
| 2101 |
} |
| 2102 |
}; |
| 2103 |
|
| 2104 |
Slick.prototype.setFade = function () { |
| 2105 |
var _ = this, |
| 2106 |
targetLeft; |
| 2107 |
|
| 2108 |
_.$slides.each(function (index, element) { |
| 2109 |
targetLeft = _.slideWidth * index * -1; |
| 2110 |
if (_.options.rtl === true) { |
| 2111 |
$(element).css({ |
| 2112 |
position: "relative", |
| 2113 |
right: targetLeft, |
| 2114 |
top: 0, |
| 2115 |
zIndex: _.options.zIndex - 2, |
| 2116 |
opacity: 0, |
| 2117 |
}); |
| 2118 |
} else { |
| 2119 |
$(element).css({ |
| 2120 |
position: "relative", |
| 2121 |
left: targetLeft, |
| 2122 |
top: 0, |
| 2123 |
zIndex: _.options.zIndex - 2, |
| 2124 |
opacity: 0, |
| 2125 |
}); |
| 2126 |
} |
| 2127 |
}); |
| 2128 |
|
| 2129 |
_.$slides.eq(_.currentSlide).css({ |
| 2130 |
zIndex: _.options.zIndex - 1, |
| 2131 |
opacity: 1, |
| 2132 |
}); |
| 2133 |
}; |
| 2134 |
|
| 2135 |
Slick.prototype.setHeight = function () { |
| 2136 |
var _ = this; |
| 2137 |
|
| 2138 |
if ( |
| 2139 |
_.options.slidesToShow === 1 && |
| 2140 |
_.options.adaptiveHeight === true && |
| 2141 |
_.options.vertical === false |
| 2142 |
) { |
| 2143 |
var targetHeight = _.$slides.eq(_.currentSlide).outerHeight(true); |
| 2144 |
_.$list.css("height", targetHeight); |
| 2145 |
} |
| 2146 |
}; |
| 2147 |
|
| 2148 |
Slick.prototype.setOption = Slick.prototype.slickSetOption = function () { |
| 2149 |
/** |
| 2150 |
* accepts arguments in format of: |
| 2151 |
* |
| 2152 |
* - for changing a single option's value: |
| 2153 |
* .slick("setOption", option, value, refresh ) |
| 2154 |
* |
| 2155 |
* - for changing a set of responsive options: |
| 2156 |
* .slick("setOption", 'responsive', [{}, ...], refresh ) |
| 2157 |
* |
| 2158 |
* - for updating multiple values at once (not responsive) |
| 2159 |
* .slick("setOption", { 'option': value, ... }, refresh ) |
| 2160 |
*/ |
| 2161 |
|
| 2162 |
var _ = this, |
| 2163 |
l, |
| 2164 |
item, |
| 2165 |
option, |
| 2166 |
value, |
| 2167 |
refresh = false, |
| 2168 |
type; |
| 2169 |
|
| 2170 |
if ($.type(arguments[0]) === "object") { |
| 2171 |
option = arguments[0]; |
| 2172 |
refresh = arguments[1]; |
| 2173 |
type = "multiple"; |
| 2174 |
} else if ($.type(arguments[0]) === "string") { |
| 2175 |
option = arguments[0]; |
| 2176 |
value = arguments[1]; |
| 2177 |
refresh = arguments[2]; |
| 2178 |
|
| 2179 |
if (arguments[0] === "responsive" && $.type(arguments[1]) === "array") { |
| 2180 |
type = "responsive"; |
| 2181 |
} else if (typeof arguments[1] !== "undefined") { |
| 2182 |
type = "single"; |
| 2183 |
} |
| 2184 |
} |
| 2185 |
|
| 2186 |
if (type === "single") { |
| 2187 |
_.options[option] = value; |
| 2188 |
} else if (type === "multiple") { |
| 2189 |
$.each(option, function (opt, val) { |
| 2190 |
_.options[opt] = val; |
| 2191 |
}); |
| 2192 |
} else if (type === "responsive") { |
| 2193 |
for (item in value) { |
| 2194 |
if ($.type(_.options.responsive) !== "array") { |
| 2195 |
_.options.responsive = [value[item]]; |
| 2196 |
} else { |
| 2197 |
l = _.options.responsive.length - 1; |
| 2198 |
|
| 2199 |
// loop through the responsive object and splice out duplicates. |
| 2200 |
while (l >= 0) { |
| 2201 |
if (_.options.responsive[l].breakpoint === value[item].breakpoint) { |
| 2202 |
_.options.responsive.splice(l, 1); |
| 2203 |
} |
| 2204 |
|
| 2205 |
l--; |
| 2206 |
} |
| 2207 |
|
| 2208 |
_.options.responsive.push(value[item]); |
| 2209 |
} |
| 2210 |
} |
| 2211 |
} |
| 2212 |
|
| 2213 |
if (refresh) { |
| 2214 |
_.unload(); |
| 2215 |
_.reinit(); |
| 2216 |
} |
| 2217 |
}; |
| 2218 |
|
| 2219 |
Slick.prototype.setPosition = function () { |
| 2220 |
var _ = this; |
| 2221 |
|
| 2222 |
_.setDimensions(); |
| 2223 |
|
| 2224 |
_.setHeight(); |
| 2225 |
|
| 2226 |
if (_.options.fade === false) { |
| 2227 |
_.setCSS(_.getLeft(_.currentSlide)); |
| 2228 |
} else { |
| 2229 |
_.setFade(); |
| 2230 |
} |
| 2231 |
|
| 2232 |
_.$slider.trigger("setPosition", [_]); |
| 2233 |
}; |
| 2234 |
|
| 2235 |
Slick.prototype.setProps = function () { |
| 2236 |
var _ = this, |
| 2237 |
bodyStyle = document.body.style; |
| 2238 |
|
| 2239 |
_.positionProp = _.options.vertical === true ? "top" : "left"; |
| 2240 |
|
| 2241 |
if (_.positionProp === "top") { |
| 2242 |
_.$slider.addClass("slick-vertical"); |
| 2243 |
} else { |
| 2244 |
_.$slider.removeClass("slick-vertical"); |
| 2245 |
} |
| 2246 |
|
| 2247 |
if ( |
| 2248 |
bodyStyle.WebkitTransition !== undefined || |
| 2249 |
bodyStyle.MozTransition !== undefined || |
| 2250 |
bodyStyle.msTransition !== undefined |
| 2251 |
) { |
| 2252 |
if (_.options.useCSS === true) { |
| 2253 |
_.cssTransitions = true; |
| 2254 |
} |
| 2255 |
} |
| 2256 |
|
| 2257 |
if (_.options.fade) { |
| 2258 |
if (typeof _.options.zIndex === "number") { |
| 2259 |
if (_.options.zIndex < 3) { |
| 2260 |
_.options.zIndex = 3; |
| 2261 |
} |
| 2262 |
} else { |
| 2263 |
_.options.zIndex = _.defaults.zIndex; |
| 2264 |
} |
| 2265 |
} |
| 2266 |
|
| 2267 |
if (bodyStyle.OTransform !== undefined) { |
| 2268 |
_.animType = "OTransform"; |
| 2269 |
_.transformType = "-o-transform"; |
| 2270 |
_.transitionType = "OTransition"; |
| 2271 |
if ( |
| 2272 |
bodyStyle.perspectiveProperty === undefined && |
| 2273 |
bodyStyle.webkitPerspective === undefined |
| 2274 |
) { |
| 2275 |
_.animType = false; |
| 2276 |
} |
| 2277 |
} |
| 2278 |
if (bodyStyle.MozTransform !== undefined) { |
| 2279 |
_.animType = "MozTransform"; |
| 2280 |
_.transformType = "-moz-transform"; |
| 2281 |
_.transitionType = "MozTransition"; |
| 2282 |
if ( |
| 2283 |
bodyStyle.perspectiveProperty === undefined && |
| 2284 |
bodyStyle.MozPerspective === undefined |
| 2285 |
) { |
| 2286 |
_.animType = false; |
| 2287 |
} |
| 2288 |
} |
| 2289 |
if (bodyStyle.webkitTransform !== undefined) { |
| 2290 |
_.animType = "webkitTransform"; |
| 2291 |
_.transformType = "-webkit-transform"; |
| 2292 |
_.transitionType = "webkitTransition"; |
| 2293 |
if ( |
| 2294 |
bodyStyle.perspectiveProperty === undefined && |
| 2295 |
bodyStyle.webkitPerspective === undefined |
| 2296 |
) { |
| 2297 |
_.animType = false; |
| 2298 |
} |
| 2299 |
} |
| 2300 |
if (bodyStyle.msTransform !== undefined) { |
| 2301 |
_.animType = "msTransform"; |
| 2302 |
_.transformType = "-ms-transform"; |
| 2303 |
_.transitionType = "msTransition"; |
| 2304 |
if (bodyStyle.msTransform === undefined) { |
| 2305 |
_.animType = false; |
| 2306 |
} |
| 2307 |
} |
| 2308 |
if (bodyStyle.transform !== undefined && _.animType !== false) { |
| 2309 |
_.animType = "transform"; |
| 2310 |
_.transformType = "transform"; |
| 2311 |
_.transitionType = "transition"; |
| 2312 |
} |
| 2313 |
_.transformsEnabled = |
| 2314 |
_.options.useTransform && _.animType !== null && _.animType !== false; |
| 2315 |
}; |
| 2316 |
|
| 2317 |
Slick.prototype.setSlideClasses = function (index) { |
| 2318 |
var _ = this, |
| 2319 |
centerOffset, |
| 2320 |
allSlides, |
| 2321 |
indexOffset, |
| 2322 |
remainder; |
| 2323 |
|
| 2324 |
allSlides = _.$slider |
| 2325 |
.find(".slick-slide") |
| 2326 |
.removeClass("slick-active slick-center slick-current") |
| 2327 |
.attr("aria-hidden", "true"); |
| 2328 |
|
| 2329 |
_.$slides.eq(index).addClass("slick-current"); |
| 2330 |
|
| 2331 |
if (_.options.centerMode === true) { |
| 2332 |
var evenCoef = _.options.slidesToShow % 2 === 0 ? 1 : 0; |
| 2333 |
|
| 2334 |
centerOffset = Math.floor(_.options.slidesToShow / 2); |
| 2335 |
|
| 2336 |
if (_.options.infinite === true) { |
| 2337 |
if (index >= centerOffset && index <= _.slideCount - 1 - centerOffset) { |
| 2338 |
_.$slides |
| 2339 |
.slice(index - centerOffset + evenCoef, index + centerOffset + 1) |
| 2340 |
.addClass("slick-active") |
| 2341 |
.attr("aria-hidden", "false"); |
| 2342 |
} else { |
| 2343 |
indexOffset = _.options.slidesToShow + index; |
| 2344 |
allSlides |
| 2345 |
.slice( |
| 2346 |
indexOffset - centerOffset + 1 + evenCoef, |
| 2347 |
indexOffset + centerOffset + 2 |
| 2348 |
) |
| 2349 |
.addClass("slick-active") |
| 2350 |
.attr("aria-hidden", "false"); |
| 2351 |
} |
| 2352 |
|
| 2353 |
if (index === 0) { |
| 2354 |
allSlides |
| 2355 |
.eq(_.options.slidesToShow + _.slideCount + 1) |
| 2356 |
.addClass("slick-center"); |
| 2357 |
} else if (index === _.slideCount - 1) { |
| 2358 |
allSlides.eq(_.options.slidesToShow).addClass("slick-center"); |
| 2359 |
} |
| 2360 |
} |
| 2361 |
|
| 2362 |
_.$slides.eq(index).addClass("slick-center"); |
| 2363 |
} else { |
| 2364 |
if (index >= 0 && index <= _.slideCount - _.options.slidesToShow) { |
| 2365 |
_.$slides |
| 2366 |
.slice(index, index + _.options.slidesToShow) |
| 2367 |
.addClass("slick-active") |
| 2368 |
.attr("aria-hidden", "false"); |
| 2369 |
} else if (allSlides.length <= _.options.slidesToShow) { |
| 2370 |
allSlides.addClass("slick-active").attr("aria-hidden", "false"); |
| 2371 |
} else { |
| 2372 |
remainder = _.slideCount % _.options.slidesToShow; |
| 2373 |
indexOffset = |
| 2374 |
_.options.infinite === true ? _.options.slidesToShow + index : index; |
| 2375 |
|
| 2376 |
if ( |
| 2377 |
_.options.slidesToShow == _.options.slidesToScroll && |
| 2378 |
_.slideCount - index < _.options.slidesToShow |
| 2379 |
) { |
| 2380 |
allSlides |
| 2381 |
.slice( |
| 2382 |
indexOffset - (_.options.slidesToShow - remainder), |
| 2383 |
indexOffset + remainder |
| 2384 |
) |
| 2385 |
.addClass("slick-active") |
| 2386 |
.attr("aria-hidden", "false"); |
| 2387 |
} else { |
| 2388 |
allSlides |
| 2389 |
.slice(indexOffset, indexOffset + _.options.slidesToShow) |
| 2390 |
.addClass("slick-active") |
| 2391 |
.attr("aria-hidden", "false"); |
| 2392 |
} |
| 2393 |
} |
| 2394 |
} |
| 2395 |
|
| 2396 |
if ( |
| 2397 |
_.options.lazyLoad === "ondemand" || |
| 2398 |
_.options.lazyLoad === "anticipated" |
| 2399 |
) { |
| 2400 |
_.lazyLoad(); |
| 2401 |
} |
| 2402 |
}; |
| 2403 |
|
| 2404 |
Slick.prototype.setupInfinite = function () { |
| 2405 |
var _ = this, |
| 2406 |
i, |
| 2407 |
slideIndex, |
| 2408 |
infiniteCount; |
| 2409 |
|
| 2410 |
if (_.options.fade === true) { |
| 2411 |
_.options.centerMode = false; |
| 2412 |
} |
| 2413 |
|
| 2414 |
if (_.options.infinite === true && _.options.fade === false) { |
| 2415 |
slideIndex = null; |
| 2416 |
|
| 2417 |
if (_.slideCount > _.options.slidesToShow) { |
| 2418 |
if (_.options.centerMode === true) { |
| 2419 |
infiniteCount = _.options.slidesToShow + 1; |
| 2420 |
} else { |
| 2421 |
infiniteCount = _.options.slidesToShow; |
| 2422 |
} |
| 2423 |
|
| 2424 |
for (i = _.slideCount; i > _.slideCount - infiniteCount; i -= 1) { |
| 2425 |
slideIndex = i - 1; |
| 2426 |
$(_.$slides[slideIndex]) |
| 2427 |
.clone(true) |
| 2428 |
.attr("id", "") |
| 2429 |
.attr("data-slick-index", slideIndex - _.slideCount) |
| 2430 |
.prependTo(_.$slideTrack) |
| 2431 |
.addClass("slick-cloned"); |
| 2432 |
} |
| 2433 |
for (i = 0; i < infiniteCount + _.slideCount; i += 1) { |
| 2434 |
slideIndex = i; |
| 2435 |
$(_.$slides[slideIndex]) |
| 2436 |
.clone(true) |
| 2437 |
.attr("id", "") |
| 2438 |
.attr("data-slick-index", slideIndex + _.slideCount) |
| 2439 |
.appendTo(_.$slideTrack) |
| 2440 |
.addClass("slick-cloned"); |
| 2441 |
} |
| 2442 |
_.$slideTrack |
| 2443 |
.find(".slick-cloned") |
| 2444 |
.find("[id]") |
| 2445 |
.each(function () { |
| 2446 |
$(this).attr("id", ""); |
| 2447 |
}); |
| 2448 |
} |
| 2449 |
} |
| 2450 |
}; |
| 2451 |
|
| 2452 |
Slick.prototype.interrupt = function (toggle) { |
| 2453 |
var _ = this; |
| 2454 |
|
| 2455 |
if (!toggle) { |
| 2456 |
_.autoPlay(); |
| 2457 |
} |
| 2458 |
_.interrupted = toggle; |
| 2459 |
}; |
| 2460 |
|
| 2461 |
Slick.prototype.selectHandler = function (event) { |
| 2462 |
var _ = this; |
| 2463 |
|
| 2464 |
var targetElement = $(event.target).is(".slick-slide") |
| 2465 |
? $(event.target) |
| 2466 |
: $(event.target).parents(".slick-slide"); |
| 2467 |
|
| 2468 |
var index = parseInt(targetElement.attr("data-slick-index")); |
| 2469 |
|
| 2470 |
if (!index) { |
| 2471 |
index = 0; |
| 2472 |
} |
| 2473 |
|
| 2474 |
if (_.slideCount <= _.options.slidesToShow) { |
| 2475 |
_.slideHandler(index, false, true); |
| 2476 |
return; |
| 2477 |
} |
| 2478 |
|
| 2479 |
_.slideHandler(index); |
| 2480 |
}; |
| 2481 |
|
| 2482 |
Slick.prototype.slideHandler = function (index, sync, dontAnimate) { |
| 2483 |
var targetSlide, |
| 2484 |
animSlide, |
| 2485 |
oldSlide, |
| 2486 |
slideLeft, |
| 2487 |
targetLeft = null, |
| 2488 |
_ = this, |
| 2489 |
navTarget; |
| 2490 |
|
| 2491 |
sync = sync || false; |
| 2492 |
|
| 2493 |
if (_.animating === true && _.options.waitForAnimate === true) { |
| 2494 |
return; |
| 2495 |
} |
| 2496 |
|
| 2497 |
if (_.options.fade === true && _.currentSlide === index) { |
| 2498 |
return; |
| 2499 |
} |
| 2500 |
|
| 2501 |
if (sync === false) { |
| 2502 |
_.asNavFor(index); |
| 2503 |
} |
| 2504 |
|
| 2505 |
targetSlide = index; |
| 2506 |
targetLeft = _.getLeft(targetSlide); |
| 2507 |
slideLeft = _.getLeft(_.currentSlide); |
| 2508 |
|
| 2509 |
_.currentLeft = _.swipeLeft === null ? slideLeft : _.swipeLeft; |
| 2510 |
|
| 2511 |
if ( |
| 2512 |
_.options.infinite === false && |
| 2513 |
_.options.centerMode === false && |
| 2514 |
(index < 0 || index > _.getDotCount() * _.options.slidesToScroll) |
| 2515 |
) { |
| 2516 |
if (_.options.fade === false) { |
| 2517 |
targetSlide = _.currentSlide; |
| 2518 |
if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { |
| 2519 |
_.animateSlide(slideLeft, function () { |
| 2520 |
_.postSlide(targetSlide); |
| 2521 |
}); |
| 2522 |
} else { |
| 2523 |
_.postSlide(targetSlide); |
| 2524 |
} |
| 2525 |
} |
| 2526 |
return; |
| 2527 |
} else if ( |
| 2528 |
_.options.infinite === false && |
| 2529 |
_.options.centerMode === true && |
| 2530 |
(index < 0 || index > _.slideCount - _.options.slidesToScroll) |
| 2531 |
) { |
| 2532 |
if (_.options.fade === false) { |
| 2533 |
targetSlide = _.currentSlide; |
| 2534 |
if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { |
| 2535 |
_.animateSlide(slideLeft, function () { |
| 2536 |
_.postSlide(targetSlide); |
| 2537 |
}); |
| 2538 |
} else { |
| 2539 |
_.postSlide(targetSlide); |
| 2540 |
} |
| 2541 |
} |
| 2542 |
return; |
| 2543 |
} |
| 2544 |
|
| 2545 |
if (_.options.autoplay) { |
| 2546 |
clearInterval(_.autoPlayTimer); |
| 2547 |
} |
| 2548 |
|
| 2549 |
if (targetSlide < 0) { |
| 2550 |
if (_.slideCount % _.options.slidesToScroll !== 0) { |
| 2551 |
animSlide = _.slideCount - (_.slideCount % _.options.slidesToScroll); |
| 2552 |
} else { |
| 2553 |
animSlide = _.slideCount + targetSlide; |
| 2554 |
} |
| 2555 |
} else if (targetSlide >= _.slideCount) { |
| 2556 |
if (_.slideCount % _.options.slidesToScroll !== 0) { |
| 2557 |
animSlide = 0; |
| 2558 |
} else { |
| 2559 |
animSlide = targetSlide - _.slideCount; |
| 2560 |
} |
| 2561 |
} else { |
| 2562 |
animSlide = targetSlide; |
| 2563 |
} |
| 2564 |
|
| 2565 |
_.animating = true; |
| 2566 |
|
| 2567 |
_.$slider.trigger("beforeChange", [_, _.currentSlide, animSlide]); |
| 2568 |
|
| 2569 |
oldSlide = _.currentSlide; |
| 2570 |
_.currentSlide = animSlide; |
| 2571 |
|
| 2572 |
_.setSlideClasses(_.currentSlide); |
| 2573 |
|
| 2574 |
if (_.options.asNavFor) { |
| 2575 |
navTarget = _.getNavTarget(); |
| 2576 |
navTarget = navTarget.slick("getSlick"); |
| 2577 |
|
| 2578 |
if (navTarget.slideCount <= navTarget.options.slidesToShow) { |
| 2579 |
navTarget.setSlideClasses(_.currentSlide); |
| 2580 |
} |
| 2581 |
} |
| 2582 |
|
| 2583 |
_.updateDots(); |
| 2584 |
_.updateArrows(); |
| 2585 |
|
| 2586 |
if (_.options.fade === true) { |
| 2587 |
if (dontAnimate !== true) { |
| 2588 |
_.fadeSlideOut(oldSlide); |
| 2589 |
|
| 2590 |
_.fadeSlide(animSlide, function () { |
| 2591 |
_.postSlide(animSlide); |
| 2592 |
}); |
| 2593 |
} else { |
| 2594 |
_.postSlide(animSlide); |
| 2595 |
} |
| 2596 |
_.animateHeight(); |
| 2597 |
return; |
| 2598 |
} |
| 2599 |
|
| 2600 |
if (dontAnimate !== true && _.slideCount > _.options.slidesToShow) { |
| 2601 |
_.animateSlide(targetLeft, function () { |
| 2602 |
_.postSlide(animSlide); |
| 2603 |
}); |
| 2604 |
} else { |
| 2605 |
_.postSlide(animSlide); |
| 2606 |
} |
| 2607 |
}; |
| 2608 |
|
| 2609 |
Slick.prototype.startLoad = function () { |
| 2610 |
var _ = this; |
| 2611 |
|
| 2612 |
if (_.options.arrows === true && _.slideCount > _.options.slidesToShow) { |
| 2613 |
_.$prevArrow.hide(); |
| 2614 |
_.$nextArrow.hide(); |
| 2615 |
} |
| 2616 |
|
| 2617 |
if (_.options.dots === true && _.slideCount > _.options.slidesToShow) { |
| 2618 |
_.$dots.hide(); |
| 2619 |
} |
| 2620 |
|
| 2621 |
_.$slider.addClass("slick-loading"); |
| 2622 |
}; |
| 2623 |
|
| 2624 |
Slick.prototype.swipeDirection = function () { |
| 2625 |
var xDist, |
| 2626 |
yDist, |
| 2627 |
r, |
| 2628 |
swipeAngle, |
| 2629 |
_ = this; |
| 2630 |
|
| 2631 |
xDist = _.touchObject.startX - _.touchObject.curX; |
| 2632 |
yDist = _.touchObject.startY - _.touchObject.curY; |
| 2633 |
r = Math.atan2(yDist, xDist); |
| 2634 |
|
| 2635 |
swipeAngle = Math.round((r * 180) / Math.PI); |
| 2636 |
if (swipeAngle < 0) { |
| 2637 |
swipeAngle = 360 - Math.abs(swipeAngle); |
| 2638 |
} |
| 2639 |
|
| 2640 |
if (swipeAngle <= 45 && swipeAngle >= 0) { |
| 2641 |
return _.options.rtl === false ? "left" : "right"; |
| 2642 |
} |
| 2643 |
if (swipeAngle <= 360 && swipeAngle >= 315) { |
| 2644 |
return _.options.rtl === false ? "left" : "right"; |
| 2645 |
} |
| 2646 |
if (swipeAngle >= 135 && swipeAngle <= 225) { |
| 2647 |
return _.options.rtl === false ? "right" : "left"; |
| 2648 |
} |
| 2649 |
if (_.options.verticalSwiping === true) { |
| 2650 |
if (swipeAngle >= 35 && swipeAngle <= 135) { |
| 2651 |
return "down"; |
| 2652 |
} else { |
| 2653 |
return "up"; |
| 2654 |
} |
| 2655 |
} |
| 2656 |
|
| 2657 |
return "vertical"; |
| 2658 |
}; |
| 2659 |
|
| 2660 |
Slick.prototype.swipeEnd = function (event) { |
| 2661 |
var _ = this, |
| 2662 |
slideCount, |
| 2663 |
direction; |
| 2664 |
|
| 2665 |
_.dragging = false; |
| 2666 |
_.swiping = false; |
| 2667 |
|
| 2668 |
if (_.scrolling) { |
| 2669 |
_.scrolling = false; |
| 2670 |
return false; |
| 2671 |
} |
| 2672 |
|
| 2673 |
_.interrupted = false; |
| 2674 |
_.shouldClick = _.touchObject.swipeLength > 10 ? false : true; |
| 2675 |
|
| 2676 |
if (_.touchObject.curX === undefined) { |
| 2677 |
return false; |
| 2678 |
} |
| 2679 |
|
| 2680 |
if (_.touchObject.edgeHit === true) { |
| 2681 |
_.$slider.trigger("edge", [_, _.swipeDirection()]); |
| 2682 |
} |
| 2683 |
|
| 2684 |
if (_.touchObject.swipeLength >= _.touchObject.minSwipe) { |
| 2685 |
direction = _.swipeDirection(); |
| 2686 |
|
| 2687 |
switch (direction) { |
| 2688 |
case "left": |
| 2689 |
case "down": |
| 2690 |
slideCount = _.options.swipeToSlide |
| 2691 |
? _.checkNavigable(_.currentSlide + _.getSlideCount()) |
| 2692 |
: _.currentSlide + _.getSlideCount(); |
| 2693 |
|
| 2694 |
_.currentDirection = 0; |
| 2695 |
|
| 2696 |
break; |
| 2697 |
|
| 2698 |
case "right": |
| 2699 |
case "up": |
| 2700 |
slideCount = _.options.swipeToSlide |
| 2701 |
? _.checkNavigable(_.currentSlide - _.getSlideCount()) |
| 2702 |
: _.currentSlide - _.getSlideCount(); |
| 2703 |
|
| 2704 |
_.currentDirection = 1; |
| 2705 |
|
| 2706 |
break; |
| 2707 |
|
| 2708 |
default: |
| 2709 |
} |
| 2710 |
|
| 2711 |
if (direction != "vertical") { |
| 2712 |
_.slideHandler(slideCount); |
| 2713 |
_.touchObject = {}; |
| 2714 |
_.$slider.trigger("swipe", [_, direction]); |
| 2715 |
} |
| 2716 |
} else { |
| 2717 |
if (_.touchObject.startX !== _.touchObject.curX) { |
| 2718 |
_.slideHandler(_.currentSlide); |
| 2719 |
_.touchObject = {}; |
| 2720 |
} |
| 2721 |
} |
| 2722 |
}; |
| 2723 |
|
| 2724 |
Slick.prototype.swipeHandler = function (event) { |
| 2725 |
var _ = this; |
| 2726 |
|
| 2727 |
if ( |
| 2728 |
_.options.swipe === false || |
| 2729 |
("ontouchend" in document && _.options.swipe === false) |
| 2730 |
) { |
| 2731 |
return; |
| 2732 |
} else if ( |
| 2733 |
_.options.draggable === false && |
| 2734 |
event.type.indexOf("mouse") !== -1 |
| 2735 |
) { |
| 2736 |
return; |
| 2737 |
} |
| 2738 |
|
| 2739 |
_.touchObject.fingerCount = |
| 2740 |
event.originalEvent && event.originalEvent.touches !== undefined |
| 2741 |
? event.originalEvent.touches.length |
| 2742 |
: 1; |
| 2743 |
|
| 2744 |
_.touchObject.minSwipe = _.listWidth / _.options.touchThreshold; |
| 2745 |
|
| 2746 |
if (_.options.verticalSwiping === true) { |
| 2747 |
_.touchObject.minSwipe = _.listHeight / _.options.touchThreshold; |
| 2748 |
} |
| 2749 |
|
| 2750 |
switch (event.data.action) { |
| 2751 |
case "start": |
| 2752 |
_.swipeStart(event); |
| 2753 |
break; |
| 2754 |
|
| 2755 |
case "move": |
| 2756 |
_.swipeMove(event); |
| 2757 |
break; |
| 2758 |
|
| 2759 |
case "end": |
| 2760 |
_.swipeEnd(event); |
| 2761 |
break; |
| 2762 |
} |
| 2763 |
}; |
| 2764 |
|
| 2765 |
Slick.prototype.swipeMove = function (event) { |
| 2766 |
var _ = this, |
| 2767 |
edgeWasHit = false, |
| 2768 |
curLeft, |
| 2769 |
swipeDirection, |
| 2770 |
swipeLength, |
| 2771 |
positionOffset, |
| 2772 |
touches, |
| 2773 |
verticalSwipeLength; |
| 2774 |
|
| 2775 |
touches = |
| 2776 |
event.originalEvent !== undefined ? event.originalEvent.touches : null; |
| 2777 |
|
| 2778 |
if (!_.dragging || _.scrolling || (touches && touches.length !== 1)) { |
| 2779 |
return false; |
| 2780 |
} |
| 2781 |
|
| 2782 |
curLeft = _.getLeft(_.currentSlide); |
| 2783 |
|
| 2784 |
_.touchObject.curX = |
| 2785 |
touches !== undefined ? touches[0].pageX : event.clientX; |
| 2786 |
_.touchObject.curY = |
| 2787 |
touches !== undefined ? touches[0].pageY : event.clientY; |
| 2788 |
|
| 2789 |
_.touchObject.swipeLength = Math.round( |
| 2790 |
Math.sqrt(Math.pow(_.touchObject.curX - _.touchObject.startX, 2)) |
| 2791 |
); |
| 2792 |
|
| 2793 |
verticalSwipeLength = Math.round( |
| 2794 |
Math.sqrt(Math.pow(_.touchObject.curY - _.touchObject.startY, 2)) |
| 2795 |
); |
| 2796 |
|
| 2797 |
if (!_.options.verticalSwiping && !_.swiping && verticalSwipeLength > 4) { |
| 2798 |
_.scrolling = true; |
| 2799 |
return false; |
| 2800 |
} |
| 2801 |
|
| 2802 |
if (_.options.verticalSwiping === true) { |
| 2803 |
_.touchObject.swipeLength = verticalSwipeLength; |
| 2804 |
} |
| 2805 |
|
| 2806 |
swipeDirection = _.swipeDirection(); |
| 2807 |
|
| 2808 |
if (event.originalEvent !== undefined && _.touchObject.swipeLength > 4) { |
| 2809 |
_.swiping = true; |
| 2810 |
event.preventDefault(); |
| 2811 |
} |
| 2812 |
|
| 2813 |
positionOffset = |
| 2814 |
(_.options.rtl === false ? 1 : -1) * |
| 2815 |
(_.touchObject.curX > _.touchObject.startX ? 1 : -1); |
| 2816 |
if (_.options.verticalSwiping === true) { |
| 2817 |
positionOffset = _.touchObject.curY > _.touchObject.startY ? 1 : -1; |
| 2818 |
} |
| 2819 |
|
| 2820 |
swipeLength = _.touchObject.swipeLength; |
| 2821 |
|
| 2822 |
_.touchObject.edgeHit = false; |
| 2823 |
|
| 2824 |
if (_.options.infinite === false) { |
| 2825 |
if ( |
| 2826 |
(_.currentSlide === 0 && swipeDirection === "right") || |
| 2827 |
(_.currentSlide >= _.getDotCount() && swipeDirection === "left") |
| 2828 |
) { |
| 2829 |
swipeLength = _.touchObject.swipeLength * _.options.edgeFriction; |
| 2830 |
_.touchObject.edgeHit = true; |
| 2831 |
} |
| 2832 |
} |
| 2833 |
|
| 2834 |
if (_.options.vertical === false) { |
| 2835 |
_.swipeLeft = curLeft + swipeLength * positionOffset; |
| 2836 |
} else { |
| 2837 |
_.swipeLeft = |
| 2838 |
curLeft + |
| 2839 |
swipeLength * (_.$list.height() / _.listWidth) * positionOffset; |
| 2840 |
} |
| 2841 |
if (_.options.verticalSwiping === true) { |
| 2842 |
_.swipeLeft = curLeft + swipeLength * positionOffset; |
| 2843 |
} |
| 2844 |
|
| 2845 |
if (_.options.fade === true || _.options.touchMove === false) { |
| 2846 |
return false; |
| 2847 |
} |
| 2848 |
|
| 2849 |
if (_.animating === true) { |
| 2850 |
_.swipeLeft = null; |
| 2851 |
return false; |
| 2852 |
} |
| 2853 |
|
| 2854 |
_.setCSS(_.swipeLeft); |
| 2855 |
}; |
| 2856 |
|
| 2857 |
Slick.prototype.swipeStart = function (event) { |
| 2858 |
var _ = this, |
| 2859 |
touches; |
| 2860 |
|
| 2861 |
_.interrupted = true; |
| 2862 |
|
| 2863 |
if ( |
| 2864 |
_.touchObject.fingerCount !== 1 || |
| 2865 |
_.slideCount <= _.options.slidesToShow |
| 2866 |
) { |
| 2867 |
_.touchObject = {}; |
| 2868 |
return false; |
| 2869 |
} |
| 2870 |
|
| 2871 |
if ( |
| 2872 |
event.originalEvent !== undefined && |
| 2873 |
event.originalEvent.touches !== undefined |
| 2874 |
) { |
| 2875 |
touches = event.originalEvent.touches[0]; |
| 2876 |
} |
| 2877 |
|
| 2878 |
_.touchObject.startX = _.touchObject.curX = |
| 2879 |
touches !== undefined ? touches.pageX : event.clientX; |
| 2880 |
_.touchObject.startY = _.touchObject.curY = |
| 2881 |
touches !== undefined ? touches.pageY : event.clientY; |
| 2882 |
|
| 2883 |
_.dragging = true; |
| 2884 |
}; |
| 2885 |
|
| 2886 |
Slick.prototype.unfilterSlides = Slick.prototype.slickUnfilter = function () { |
| 2887 |
var _ = this; |
| 2888 |
|
| 2889 |
if (_.$slidesCache !== null) { |
| 2890 |
_.unload(); |
| 2891 |
|
| 2892 |
_.$slideTrack.children(this.options.slide).detach(); |
| 2893 |
|
| 2894 |
_.$slidesCache.appendTo(_.$slideTrack); |
| 2895 |
|
| 2896 |
_.reinit(); |
| 2897 |
} |
| 2898 |
}; |
| 2899 |
|
| 2900 |
Slick.prototype.unload = function () { |
| 2901 |
var _ = this; |
| 2902 |
|
| 2903 |
$(".slick-cloned", _.$slider).remove(); |
| 2904 |
|
| 2905 |
if (_.$dots) { |
| 2906 |
_.$dots.remove(); |
| 2907 |
} |
| 2908 |
|
| 2909 |
if (_.$prevArrow && _.htmlExpr.test(_.options.prevArrow)) { |
| 2910 |
_.$prevArrow.remove(); |
| 2911 |
} |
| 2912 |
|
| 2913 |
if (_.$nextArrow && _.htmlExpr.test(_.options.nextArrow)) { |
| 2914 |
_.$nextArrow.remove(); |
| 2915 |
} |
| 2916 |
|
| 2917 |
_.$slides |
| 2918 |
.removeClass("slick-slide slick-active slick-visible slick-current") |
| 2919 |
.attr("aria-hidden", "true") |
| 2920 |
.css("width", ""); |
| 2921 |
}; |
| 2922 |
|
| 2923 |
Slick.prototype.unslick = function (fromBreakpoint) { |
| 2924 |
var _ = this; |
| 2925 |
_.$slider.trigger("unslick", [_, fromBreakpoint]); |
| 2926 |
_.destroy(); |
| 2927 |
}; |
| 2928 |
|
| 2929 |
Slick.prototype.updateArrows = function () { |
| 2930 |
var _ = this, |
| 2931 |
centerOffset; |
| 2932 |
|
| 2933 |
centerOffset = Math.floor(_.options.slidesToShow / 2); |
| 2934 |
|
| 2935 |
if ( |
| 2936 |
_.options.arrows === true && |
| 2937 |
_.slideCount > _.options.slidesToShow && |
| 2938 |
!_.options.infinite |
| 2939 |
) { |
| 2940 |
_.$prevArrow.removeClass("slick-disabled").attr("aria-disabled", "false"); |
| 2941 |
_.$nextArrow.removeClass("slick-disabled").attr("aria-disabled", "false"); |
| 2942 |
|
| 2943 |
if (_.currentSlide === 0) { |
| 2944 |
_.$prevArrow.addClass("slick-disabled").attr("aria-disabled", "true"); |
| 2945 |
_.$nextArrow |
| 2946 |
.removeClass("slick-disabled") |
| 2947 |
.attr("aria-disabled", "false"); |
| 2948 |
} else if ( |
| 2949 |
_.currentSlide >= _.slideCount - _.options.slidesToShow && |
| 2950 |
_.options.centerMode === false |
| 2951 |
) { |
| 2952 |
_.$nextArrow.addClass("slick-disabled").attr("aria-disabled", "true"); |
| 2953 |
_.$prevArrow |
| 2954 |
.removeClass("slick-disabled") |
| 2955 |
.attr("aria-disabled", "false"); |
| 2956 |
} else if ( |
| 2957 |
_.currentSlide >= _.slideCount - 1 && |
| 2958 |
_.options.centerMode === true |
| 2959 |
) { |
| 2960 |
_.$nextArrow.addClass("slick-disabled").attr("aria-disabled", "true"); |
| 2961 |
_.$prevArrow |
| 2962 |
.removeClass("slick-disabled") |
| 2963 |
.attr("aria-disabled", "false"); |
| 2964 |
} |
| 2965 |
} |
| 2966 |
}; |
| 2967 |
|
| 2968 |
Slick.prototype.updateDots = function () { |
| 2969 |
var _ = this; |
| 2970 |
|
| 2971 |
if (_.$dots !== null) { |
| 2972 |
_.$dots.find("li").removeClass("slick-active").end(); |
| 2973 |
|
| 2974 |
_.$dots |
| 2975 |
.find("li") |
| 2976 |
.eq(Math.floor(_.currentSlide / _.options.slidesToScroll)) |
| 2977 |
.addClass("slick-active"); |
| 2978 |
} |
| 2979 |
}; |
| 2980 |
|
| 2981 |
Slick.prototype.visibility = function () { |
| 2982 |
var _ = this; |
| 2983 |
|
| 2984 |
if (_.options.autoplay) { |
| 2985 |
if (document[_.hidden]) { |
| 2986 |
_.interrupted = true; |
| 2987 |
} else { |
| 2988 |
_.interrupted = false; |
| 2989 |
} |
| 2990 |
} |
| 2991 |
}; |
| 2992 |
|
| 2993 |
$.fn.slick = function () { |
| 2994 |
var _ = this, |
| 2995 |
opt = arguments[0], |
| 2996 |
args = Array.prototype.slice.call(arguments, 1), |
| 2997 |
l = _.length, |
| 2998 |
i, |
| 2999 |
ret; |
| 3000 |
for (i = 0; i < l; i++) { |
| 3001 |
if (typeof opt == "object" || typeof opt == "undefined") { |
| 3002 |
_[i].slick = new Slick(_[i], opt); |
| 3003 |
} else { |
| 3004 |
ret = _[i].slick[opt].apply(_[i].slick, args); |
| 3005 |
} |
| 3006 |
if (typeof ret != "undefined") { |
| 3007 |
return ret; |
| 3008 |
} |
| 3009 |
} |
| 3010 |
return _; |
| 3011 |
}; |
| 3012 |
}); |
| 3013 |
|