126 lines
47 KiB
JavaScript
126 lines
47 KiB
JavaScript
|
/**
|
||
|
* Owl Carousel v2.3.4
|
||
|
* Copyright 2013-2018 David Deutsch
|
||
|
* Licensed under: SEE LICENSE IN https://github.com/OwlCarousel2/OwlCarousel2/blob/master/LICENSE
|
||
|
*/
|
||
|
!function(a,b,c,d){function e(b,c){this.settings=null,this.options=a.extend({},e.Defaults,c),this.$element=a(b),this._handlers={},this._plugins={},this._supress={},this._current=null,this._speed=null,this._coordinates=[],this._breakpoint=null,this._width=null,this._items=[],this._clones=[],this._mergers=[],this._widths=[],this._invalidated={},this._pipe=[],this._drag={time:null,target:null,pointer:null,stage:{start:null,current:null},direction:null},this._states={current:{},tags:{initializing:["busy"],animating:["busy"],dragging:["interacting"]}},a.each(["onResize","onThrottledResize"],a.proxy(function(b,c){this._handlers[c]=a.proxy(this[c],this)},this)),a.each(e.Plugins,a.proxy(function(a,b){this._plugins[a.charAt(0).toLowerCase()+a.slice(1)]=new b(this)},this)),a.each(e.Workers,a.proxy(function(b,c){this._pipe.push({filter:c.filter,run:a.proxy(c.run,this)})},this)),this.setup(),this.initialize()}e.Defaults={items:3,loop:!1,center:!1,rewind:!1,checkVisibility:!0,mouseDrag:!0,touchDrag:!0,pullDrag:!0,freeDrag:!1,margin:0,stagePadding:0,merge:!1,mergeFit:!0,autoWidth:!1,startPosition:0,rtl:!1,smartSpeed:250,fluidSpeed:!1,dragEndSpeed:!1,responsive:{},responsiveRefreshRate:200,responsiveBaseElement:b,fallbackEasing:"swing",slideTransition:"",info:!1,nestedItemSelector:!1,itemElement:"div",stageElement:"div",refreshClass:"owl-refresh",loadedClass:"owl-loaded",loadingClass:"owl-loading",rtlClass:"owl-rtl",responsiveClass:"owl-responsive",dragClass:"owl-drag",itemClass:"owl-item",stageClass:"owl-stage",stageOuterClass:"owl-stage-outer",grabClass:"owl-grab"},e.Width={Default:"default",Inner:"inner",Outer:"outer"},e.Type={Event:"event",State:"state"},e.Plugins={},e.Workers=[{filter:["width","settings"],run:function(){this._width=this.$element.width()}},{filter:["width","items","settings"],run:function(a){a.current=this._items&&this._items[this.relative(this._current)]}},{filter:["items","settings"],run:function(){this.$stage.children(".cloned").remove()}},{filter:["width","items","settings"],run:function(a){var b=this.settings.margin||"",c=!this.settings.autoWidth,d=this.settings.rtl,e={width:"auto","margin-left":d?b:"","margin-right":d?"":b};!c&&this.$stage.children().css(e),a.css=e}},{filter:["width","items","settings"],run:function(a){var b=(this.width()/this.settings.items).toFixed(3)-this.settings.margin,c=null,d=this._items.length,e=!this.settings.autoWidth,f=[];for(a.items={merge:!1,width:b};d--;)c=this._mergers[d],c=this.settings.mergeFit&&Math.min(c,this.settings.items)||c,a.items.merge=c>1||a.items.merge,f[d]=e?b*c:this._items[d].width();this._widths=f}},{filter:["items","settings"],run:function(){var b=[],c=this._items,d=this.settings,e=Math.max(2*d.items,4),f=2*Math.ceil(c.length/2),g=d.loop&&c.length?d.rewind?e:Math.max(e,f):0,h="",i="";for(g/=2;g>0;)b.push(this.normalize(b.length/2,!0)),h+=c[b[b.length-1]][0].outerHTML,b.push(this.normalize(c.length-1-(b.length-1)/2,!0)),i=c[b[b.length-1]][0].outerHTML+i,g-=1;this._clones=b,a(h).addClass("cloned").appendTo(this.$stage),a(i).addClass("cloned").prependTo(this.$stage)}},{filter:["width","items","settings"],run:function(){for(var a=this.settings.rtl?1:-1,b=this._clones.length+this._items.length,c=-1,d=0,e=0,f=[];++c<b;)d=f[c-1]||0,e=this._widths[this.relative(c)]+this.settings.margin,f.push(d+e*a);this._coordinates=f}},{filter:["width","items","settings"],run:function(){var a=this.settings.stagePadding,b=this._coordinates,c={width:Math.ceil(Math.abs(b[b.length-1]))+2*a,"padding-left":a||"","padding-right":a||""};this.$stage.css(c)}},{filter:["width","items","settings"],run:function(a){var b=this._coordinates.length,c=!this.settings.autoWidth,d=this.$stage.children();if(c&&a.items.merge)for(;b--;)a.css.width=this._widths[this.relative(b)],d.eq(b).css(a.css);else c&&(a.css.width=a.items.width,d.css(a.css))}},{filter:["items"],run:function(){this._coordinates.length<1&&this.$stage.removeAttr("style")}},{filter:["width","items","settings"],run:function(a){a.current=a.current?this.$stage.children().index(a.current):0,a.current=Math.max(this.minimum(),Math.min(this.maximum
|
||
|
|
||
|
window.SEMICOLON_carouselInit = function( $carouselEl ){
|
||
|
|
||
|
$carouselEl = $carouselEl.filter(':not(.customjs)');
|
||
|
|
||
|
if( $carouselEl.length < 1 ){
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
$carouselEl.each( function(){
|
||
|
let element = $(this),
|
||
|
elItems = element.attr('data-items') || 4,
|
||
|
elItemsXl = element.attr('data-items-xl') || Number( elItems ),
|
||
|
elItemsLg = element.attr('data-items-lg') || Number( elItemsXl ),
|
||
|
elItemsMd = element.attr('data-items-md') || Number( elItemsLg ),
|
||
|
elItemsSm = element.attr('data-items-sm') || Number( elItemsMd ),
|
||
|
elItemsXs = element.attr('data-items-xs') || Number( elItemsSm ),
|
||
|
elLoop = element.attr('data-loop'),
|
||
|
elAutoPlay = element.attr('data-autoplay'),
|
||
|
elSpeed = element.attr('data-speed') || 250,
|
||
|
elAnimateIn = element.attr('data-animate-in'),
|
||
|
elAnimateOut = element.attr('data-animate-out'),
|
||
|
elNav = element.attr('data-nav'),
|
||
|
elNavPrev = element.attr('data-nav-prev') || '<i class="icon-angle-left"></i>',
|
||
|
elNavNext = element.attr('data-nav-next') || '<i class="icon-angle-right"></i>',
|
||
|
elPagi = element.attr('data-pagi'),
|
||
|
elMargin = element.attr('data-margin') || 20,
|
||
|
elStage = element.attr('data-stage-padding') || 0,
|
||
|
elMerge = element.attr('data-merge'),
|
||
|
elStart = element.attr('data-start') || 0,
|
||
|
elRewind = element.attr('data-rewind'),
|
||
|
elSlideBy = element.attr('data-slideby') || 1,
|
||
|
elCenter = element.attr('data-center'),
|
||
|
elLazy = element.attr('data-lazyload'),
|
||
|
elVideo = element.attr('data-video'),
|
||
|
elRTL = element.attr('data-rtl'),
|
||
|
elAutoPlayTime = 5000,
|
||
|
elAutoPlayHoverP = true;
|
||
|
|
||
|
if( elSlideBy == 'page' ) {
|
||
|
elSlideBy = 'page';
|
||
|
} else {
|
||
|
elSlideBy = Number(elSlideBy);
|
||
|
}
|
||
|
|
||
|
if( elLoop == 'true' ){ elLoop = true; } else { elLoop = false; }
|
||
|
if( !elAutoPlay ){
|
||
|
elAutoPlay = false;
|
||
|
elAutoPlayHoverP = false;
|
||
|
} else {
|
||
|
elAutoPlayTime = Number(elAutoPlay);
|
||
|
elAutoPlay = true;
|
||
|
}
|
||
|
if( !elAnimateIn ) { elAnimateIn = false; }
|
||
|
if( !elAnimateOut ) { elAnimateOut = false; }
|
||
|
if( elNav == 'false' ){ elNav = false; } else { elNav = true; }
|
||
|
if( elPagi == 'false' ){ elPagi = false; } else { elPagi = true; }
|
||
|
if( elRewind == 'true' ){ elRewind = true; } else { elRewind = false; }
|
||
|
if( elMerge == 'true' ){ elMerge = true; } else { elMerge = false; }
|
||
|
if( elCenter == 'true' ){ elCenter = true; } else { elCenter = false; }
|
||
|
if( elLazy == 'true' ){ elLazy = true; } else { elLazy = false; }
|
||
|
if( elVideo == 'true' ){ elVideo = true; } else { elVideo = false; }
|
||
|
if( elRTL == 'true' || $('body').hasClass('rtl') ){ elRTL = true; } else { elRTL = false; }
|
||
|
|
||
|
let carousel = element.owlCarousel({
|
||
|
margin: Number(elMargin),
|
||
|
loop: elLoop,
|
||
|
stagePadding: Number(elStage),
|
||
|
merge: elMerge,
|
||
|
startPosition: Number(elStart),
|
||
|
rewind: elRewind,
|
||
|
slideBy: elSlideBy,
|
||
|
center: elCenter,
|
||
|
lazyLoad: elLazy,
|
||
|
nav: elNav,
|
||
|
navText: [elNavPrev,elNavNext],
|
||
|
autoplay: elAutoPlay,
|
||
|
autoplayTimeout: elAutoPlayTime,
|
||
|
autoplayHoverPause: elAutoPlayHoverP,
|
||
|
dots: elPagi,
|
||
|
smartSpeed: Number(elSpeed),
|
||
|
fluidSpeed: Number(elSpeed),
|
||
|
video: elVideo,
|
||
|
animateIn: elAnimateIn,
|
||
|
animateOut: elAnimateOut,
|
||
|
rtl: elRTL,
|
||
|
responsive:{
|
||
|
0:{ items: elItemsXs },
|
||
|
576:{ items: elItemsSm },
|
||
|
768:{ items: elItemsMd },
|
||
|
992:{ items: elItemsLg },
|
||
|
1200:{ items: elItemsXl }
|
||
|
},
|
||
|
onInitialized: function(){
|
||
|
SEMICOLON.slider.sliderDimensions({ 'parent': element.parents('.slider-element') });
|
||
|
SEMICOLON.initialize.lightbox({ 'parent': element });
|
||
|
SEMICOLON.widget.hoverAnimation({ 'parent': element });
|
||
|
SEMICOLON.widget.loadFlexSlider({ 'parent': element });
|
||
|
SEMICOLON.widget.counter({ 'parent': element });
|
||
|
SEMICOLON.widget.progress({ 'parent': element });
|
||
|
SEMICOLON.initialize.resizeVideos();
|
||
|
if( element.find('.owl-dot').length > 0 ) {
|
||
|
element.addClass('with-carousel-dots');
|
||
|
}
|
||
|
}
|
||
|
});
|
||
|
|
||
|
$(window).on( 'lazyLoadLoaded', function(){
|
||
|
if( element.find('.lazy').length == element.find('.lazy.lazy-loaded').length ) {
|
||
|
lazyLoadInstance.update();
|
||
|
setTimeout( function(){
|
||
|
carousel.trigger( 'refresh.owl.carousel' );
|
||
|
}, 500 );
|
||
|
}
|
||
|
});
|
||
|
|
||
|
});
|
||
|
|
||
|
};
|