231 lines
50 KiB
JavaScript
231 lines
50 KiB
JavaScript
|
|
!function(i){"use strict";"function"==typeof define&&define.amd?define(["jquery"],i):"undefined"!=typeof exports?module.exports=i(require("jquery")):i(jQuery)}(function(i){"use strict";var e=window.Slick||{};(e=function(){var e=0;return function(t,o){var s,n=this;n.defaults={accessibility:!0,adaptiveHeight:!1,appendArrows:i(t),appendDots:i(t),arrows:!0,asNavFor:null,prevArrow:'<button class="slick-prev" aria-label="Previous" type="button">Previous</button>',nextArrow:'<button class="slick-next" aria-label="Next" type="button">Next</button>',autoplay:!1,autoplaySpeed:3e3,centerMode:!1,centerPadding:"50px",cssEase:"ease",customPaging:function(e,t){return i('<button type="button" />').text(t+1)},dots:!1,dotsClass:"slick-dots",draggable:!0,easing:"linear",edgeFriction:.35,fade:!1,focusOnSelect:!1,focusOnChange:!1,infinite:!0,initialSlide:0,lazyLoad:"ondemand",mobileFirst:!1,pauseOnHover:!0,pauseOnFocus:!0,pauseOnDotsHover:!1,respondTo:"window",responsive:null,rows:1,rtl:!1,slide:"",slidesPerRow:1,slidesToShow:1,slidesToScroll:1,speed:500,swipe:!0,swipeToSlide:!1,touchMove:!0,touchThreshold:5,useCSS:!0,useTransform:!0,variableWidth:!1,vertical:!1,verticalSwiping:!1,waitForAnimate:!0,zIndex:1e3},n.initials={animating:!1,dragging:!1,autoPlayTimer:null,currentDirection:0,currentLeft:null,currentSlide:0,direction:1,$dots:null,listWidth:null,listHeight:null,loadIndex:0,$nextArrow:null,$prevArrow:null,scrolling:!1,slideCount:null,slideWidth:null,$slideTrack:null,$slides:null,sliding:!1,slideOffset:0,swipeLeft:null,swiping:!1,$list:null,touchObject:{},transformsEnabled:!1,unslicked:!1},i.extend(n,n.initials),n.activeBreakpoint=null,n.animType=null,n.animProp=null,n.breakpoints=[],n.breakpointSettings=[],n.cssTransitions=!1,n.focussed=!1,n.interrupted=!1,n.hidden="hidden",n.paused=!0,n.positionProp=null,n.respondTo=null,n.rowCount=1,n.shouldClick=!0,n.$slider=i(t),n.$slidesCache=null,n.transformType=null,n.transitionType=null,n.visibilityChange="visibilitychange",n.windowWidth=0,n.windowTimer=null,s=i(t).data("slick")||{},n.options=i.extend({},n.defaults,o,s),n.currentSlide=n.options.initialSlide,n.originalSettings=n.options,void 0!==document.mozHidden?(n.hidden="mozHidden",n.visibilityChange="mozvisibilitychange"):void 0!==document.webkitHidden&&(n.hidden="webkitHidden",n.visibilityChange="webkitvisibilitychange"),n.autoPlay=i.proxy(n.autoPlay,n),n.autoPlayClear=i.proxy(n.autoPlayClear,n),n.autoPlayIterator=i.proxy(n.autoPlayIterator,n),n.changeSlide=i.proxy(n.changeSlide,n),n.clickHandler=i.proxy(n.clickHandler,n),n.selectHandler=i.proxy(n.selectHandler,n),n.setPosition=i.proxy(n.setPosition,n),n.swipeHandler=i.proxy(n.swipeHandler,n),n.dragHandler=i.proxy(n.dragHandler,n),n.keyHandler=i.proxy(n.keyHandler,n),n.instanceUid=e++,n.htmlExpr=/^(?:\s*(<[\w\W]+>)[^>]*)$/,n.registerBreakpoints(),n.init(!0)}}()).prototype.activateADA=function(){this.$slideTrack.find(".slick-active").attr({"aria-hidden":"false"}).find("a, input, button, select").attr({tabindex:"0"})},e.prototype.addSlide=e.prototype.slickAdd=function(e,t,o){var s=this;if("boolean"==typeof t)o=t,t=null;else if(t<0||t>=s.slideCount)return!1;s.unload(),"number"==typeof t?0===t&&0===s.$slides.length?i(e).appendTo(s.$slideTrack):o?i(e).insertBefore(s.$slides.eq(t)):i(e).insertAfter(s.$slides.eq(t)):!0===o?i(e).prependTo(s.$slideTrack):i(e).appendTo(s.$slideTrack),s.$slides=s.$slideTrack.children(this.options.slide),s.$slideTrack.children(this.options.slide).detach(),s.$slideTrack.append(s.$slides),s.$slides.each(function(e,t){i(t).attr("data-slick-index",e)}),s.$slidesCache=s.$slides,s.reinit()},e.prototype.animateHeight=function(){var i=this;if(1===i.options.slidesToShow&&!0===i.options.adaptiveHeight&&!1===i.options.vertical){var e=i.$slides.eq(i.currentSlide).outerHeight(!0);i.$list.animate({height:e},i.options.speed)}},e.prototype.animateSlide=function(e,t){var o={},s=this;s.animateHeight(),!0===s.options.rtl&&!1===s.options.vertical&&(e=-e),!1===s.transformsEnabled?!1===s.options.vertical?s.$slideTrack.animate({left:e},s.options.speed,s.options.easing,t):s.$slideTrack.anim
|
||
|
|
|
||
|
|
/*
|
||
|
|
slick-animation.js
|
||
|
|
Version: 0.3.3 Beta
|
||
|
|
Author: Marvin Hübner
|
||
|
|
Docs: https://github.com/marvinhuebner/slick-animation
|
||
|
|
Repo: https://github.com/marvinhuebner/slick-animation
|
||
|
|
*/
|
||
|
|
|
||
|
|
(function ($) {
|
||
|
|
$.fn.slickAnimation = function () {
|
||
|
|
var currentSlickSlider = $(this);
|
||
|
|
|
||
|
|
var slickItems = currentSlickSlider.find('.slick-list .slick-track > div');
|
||
|
|
var firstSlickItem = currentSlickSlider.find('[data-slick-index="0"]');
|
||
|
|
|
||
|
|
var animatedClass = 'animated';
|
||
|
|
var visible = {opacity: '1'};
|
||
|
|
var hidden = {opacity: '0'};
|
||
|
|
|
||
|
|
/**
|
||
|
|
* function for setting animationIn and animationOut class
|
||
|
|
* @param obj
|
||
|
|
* @param type
|
||
|
|
* @param animationIn
|
||
|
|
* @param animatedClass
|
||
|
|
* @param visibility
|
||
|
|
*/
|
||
|
|
|
||
|
|
function slickSetAnimationDefault(obj, type, animationIn, animatedClass, visibility) {
|
||
|
|
visibility = typeof visibility !== 'undefined' ? visibility : false;
|
||
|
|
|
||
|
|
slickRemoveAnimation(obj, 'delay');
|
||
|
|
slickRemoveAnimation(obj, 'duration');
|
||
|
|
|
||
|
|
if (type['opacity'] == 1) {
|
||
|
|
obj.addClass(animationIn);
|
||
|
|
obj.addClass(animatedClass);
|
||
|
|
} else {
|
||
|
|
obj.removeClass(animationIn);
|
||
|
|
obj.removeClass(animatedClass);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (visibility) obj.css(type);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* get timeout when delay, duration, delay and duration is set
|
||
|
|
* @param delayIn
|
||
|
|
* @param durationIn
|
||
|
|
* @returns {number}
|
||
|
|
*/
|
||
|
|
|
||
|
|
function getTimeout(delayIn, durationIn) {
|
||
|
|
if (delayIn) {
|
||
|
|
return delayIn * 1000 + 1000;
|
||
|
|
|
||
|
|
} else if (durationIn) {
|
||
|
|
return durationIn * 1000;
|
||
|
|
|
||
|
|
} else if ((delayIn) || (durationIn)) {
|
||
|
|
return (delayIn * 1000) + (durationIn * 1000);
|
||
|
|
}
|
||
|
|
return 1000;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* add css animations for delay and duration
|
||
|
|
* @param obj
|
||
|
|
* @param animation
|
||
|
|
* @param value
|
||
|
|
*/
|
||
|
|
function slickAddAnimation(obj, animation, value) {
|
||
|
|
var delayInAttr = [
|
||
|
|
'animation-' + animation,
|
||
|
|
'-webkit-animation-' + animation,
|
||
|
|
'-moz-animation-' + animation,
|
||
|
|
'-o-animation-' + animation,
|
||
|
|
'-ms-animation-' + animation
|
||
|
|
];
|
||
|
|
var delayInAttributes = {};
|
||
|
|
delayInAttr.forEach(function (entry) {
|
||
|
|
|
||
|
|
delayInAttributes[entry] = value + 's';
|
||
|
|
});
|
||
|
|
obj.css(delayInAttributes);
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* remove css animations for delay and duration
|
||
|
|
* @param obj
|
||
|
|
* @param animation
|
||
|
|
*/
|
||
|
|
function slickRemoveAnimation(obj, animation) {
|
||
|
|
var delayInAttr = [
|
||
|
|
'animation-' + animation,
|
||
|
|
'-webkit-animation-' + animation,
|
||
|
|
'-moz-animation-' + animation,
|
||
|
|
'-o-animation-' + animation,
|
||
|
|
'-ms-animation-' + animation
|
||
|
|
];
|
||
|
|
var delayInAttributes = {};
|
||
|
|
delayInAttr.forEach(function (entry) {
|
||
|
|
|
||
|
|
delayInAttributes[entry] = '';
|
||
|
|
});
|
||
|
|
obj.css(delayInAttributes);
|
||
|
|
}
|
||
|
|
|
||
|
|
slickItems.each(function () {
|
||
|
|
var slickItem = $(this);
|
||
|
|
|
||
|
|
slickItem.find('[data-animation-in]').each(function () {
|
||
|
|
var self = $(this);
|
||
|
|
|
||
|
|
self.css(hidden);
|
||
|
|
|
||
|
|
var animationIn = self.attr('data-animation-in');
|
||
|
|
var animationOut = self.attr('data-animation-out');
|
||
|
|
var delayIn = self.attr('data-delay-in');
|
||
|
|
var durationIn = self.attr('data-duration-in');
|
||
|
|
var delayOut = self.attr('data-delay-out');
|
||
|
|
var durationOut = self.attr('data-duration-out');
|
||
|
|
|
||
|
|
if (animationOut) {
|
||
|
|
if (firstSlickItem.length > 0) {
|
||
|
|
if (slickItem.hasClass('slick-current')) {
|
||
|
|
|
||
|
|
slickSetAnimationDefault(self, visible, animationIn, animatedClass, true);
|
||
|
|
|
||
|
|
if (delayIn) {
|
||
|
|
slickAddAnimation(self, 'delay', delayIn);
|
||
|
|
}
|
||
|
|
if (durationIn) {
|
||
|
|
slickAddAnimation(self, 'duration', durationIn);
|
||
|
|
}
|
||
|
|
|
||
|
|
setTimeout(function () {
|
||
|
|
slickSetAnimationDefault(self, hidden, animationIn, animatedClass);
|
||
|
|
slickSetAnimationDefault(self, visible, animationOut, animatedClass);
|
||
|
|
if (delayOut) {
|
||
|
|
slickAddAnimation(self, 'delay', delayOut);
|
||
|
|
}
|
||
|
|
if (durationOut) {
|
||
|
|
slickAddAnimation(self, 'duration', durationOut);
|
||
|
|
}
|
||
|
|
setTimeout(function() {
|
||
|
|
slickRemoveAnimation(self, 'delay');
|
||
|
|
slickRemoveAnimation(self, 'duration');
|
||
|
|
}, getTimeout(delayOut, durationOut));
|
||
|
|
|
||
|
|
}, getTimeout(delayIn, durationIn));
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
currentSlickSlider.on('afterChange', function (event, slick, currentSlider) {
|
||
|
|
if (slickItem.hasClass('slick-current')) {
|
||
|
|
|
||
|
|
slickSetAnimationDefault(self, visible, animationIn, animatedClass, true);
|
||
|
|
|
||
|
|
if (delayIn) {
|
||
|
|
slickAddAnimation(self, 'delay', delayIn);
|
||
|
|
}
|
||
|
|
if (durationIn) {
|
||
|
|
slickAddAnimation(self, 'duration', durationIn);
|
||
|
|
}
|
||
|
|
|
||
|
|
setTimeout(function () {
|
||
|
|
slickSetAnimationDefault(self, hidden, animationIn, animatedClass);
|
||
|
|
slickSetAnimationDefault(self, visible, animationOut, animatedClass);
|
||
|
|
|
||
|
|
if (delayOut) {
|
||
|
|
slickAddAnimation(self, 'delay', delayOut);
|
||
|
|
}
|
||
|
|
if (durationOut) {
|
||
|
|
slickAddAnimation(self, 'duration', durationOut);
|
||
|
|
}
|
||
|
|
setTimeout(function() {
|
||
|
|
slickRemoveAnimation(self, 'delay');
|
||
|
|
slickRemoveAnimation(self, 'duration');
|
||
|
|
}, getTimeout(delayOut, durationOut));
|
||
|
|
|
||
|
|
}, getTimeout(delayIn, durationIn));
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
currentSlickSlider.on('beforeChange', function (event, slick, currentSlider) {
|
||
|
|
slickSetAnimationDefault(self, hidden, animationOut, animatedClass, true);
|
||
|
|
|
||
|
|
});
|
||
|
|
} else {
|
||
|
|
|
||
|
|
if (firstSlickItem.length > 0) {
|
||
|
|
if (slickItem.hasClass('slick-current')) {
|
||
|
|
slickSetAnimationDefault(self, visible, animationIn, animatedClass, true);
|
||
|
|
|
||
|
|
if (delayIn) {
|
||
|
|
slickAddAnimation(self, 'delay', delayIn);
|
||
|
|
}
|
||
|
|
if (durationIn) {
|
||
|
|
slickAddAnimation(self, 'duration', durationIn);
|
||
|
|
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
currentSlickSlider.on('afterChange', function (event, slick, currentSlider) {
|
||
|
|
if (slickItem.hasClass('slick-current')) {
|
||
|
|
slickSetAnimationDefault(self, visible, animationIn, animatedClass, true);
|
||
|
|
|
||
|
|
if (delayIn) {
|
||
|
|
slickAddAnimation(self, 'delay', delayIn);
|
||
|
|
}
|
||
|
|
if (durationIn) {
|
||
|
|
slickAddAnimation(self, 'duration', durationIn);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
});
|
||
|
|
|
||
|
|
|
||
|
|
currentSlickSlider.on('beforeChange', function (event, slick, currentSlider) {
|
||
|
|
slickSetAnimationDefault(self, hidden, animationIn, animatedClass, true);
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
});
|
||
|
|
});
|
||
|
|
return this;
|
||
|
|
}
|
||
|
|
})(jQuery);
|