103 lines
26 KiB
JavaScript
103 lines
26 KiB
JavaScript
|
/*
|
||
|
* jQuery FlexSlider v2.7.2
|
||
|
* Copyright 2012 WooThemes
|
||
|
* Contributing Author: Tyler Smith
|
||
|
*/
|
||
|
!function($){var e=!0;$.flexslider=function(t,a){var n=$(t);void 0===a.rtl&&"rtl"==$("html").attr("dir")&&(a.rtl=!0),n.vars=$.extend({},$.flexslider.defaults,a);var i=n.vars.namespace,r=window.navigator&&window.navigator.msPointerEnabled&&window.MSGesture,s=("ontouchstart"in window||r||window.DocumentTouch&&document instanceof DocumentTouch)&&n.vars.touch,o="click touchend MSPointerUp keyup",l="",c,d="vertical"===n.vars.direction,u=n.vars.reverse,v=n.vars.itemWidth>0,p="fade"===n.vars.animation,m=""!==n.vars.asNavFor,f={};$.data(t,"flexslider",n),f={init:function(){n.animating=!1,n.currentSlide=parseInt(n.vars.startAt?n.vars.startAt:0,10),isNaN(n.currentSlide)&&(n.currentSlide=0),n.animatingTo=n.currentSlide,n.atEnd=0===n.currentSlide||n.currentSlide===n.last,n.containerSelector=n.vars.selector.substr(0,n.vars.selector.search(" ")),n.slides=$(n.vars.selector,n),n.container=$(n.containerSelector,n),n.count=n.slides.length,n.syncExists=$(n.vars.sync).length>0,"slide"===n.vars.animation&&(n.vars.animation="swing"),n.prop=d?"top":n.vars.rtl?"marginRight":"marginLeft",n.args={},n.manualPause=!1,n.stopped=!1,n.started=!1,n.startTimeout=null,n.transitions=!n.vars.video&&!p&&n.vars.useCSS&&function(){var e=document.createElement("div"),t=["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var a in t)if(void 0!==e.style[t[a]])return n.pfx=t[a].replace("Perspective","").toLowerCase(),n.prop="-"+n.pfx+"-transform",!0;return!1}(),n.isFirefox=navigator.userAgent.toLowerCase().indexOf("firefox")>-1,n.ensureAnimationEnd="",""!==n.vars.controlsContainer&&(n.controlsContainer=$(n.vars.controlsContainer).length>0&&$(n.vars.controlsContainer)),""!==n.vars.manualControls&&(n.manualControls=$(n.vars.manualControls).length>0&&$(n.vars.manualControls)),""!==n.vars.customDirectionNav&&(n.customDirectionNav=2===$(n.vars.customDirectionNav).length&&$(n.vars.customDirectionNav)),n.vars.randomize&&(n.slides.sort(function(){return Math.round(Math.random())-.5}),n.container.empty().append(n.slides)),n.doMath(),n.setup("init"),n.vars.controlNav&&f.controlNav.setup(),n.vars.directionNav&&f.directionNav.setup(),n.vars.keyboard&&(1===$(n.containerSelector).length||n.vars.multipleKeyboard)&&$(document).bind("keyup",function(e){var t=e.keyCode;if(!n.animating&&(39===t||37===t)){var a=n.vars.rtl?37===t?n.getTarget("next"):39===t&&n.getTarget("prev"):39===t?n.getTarget("next"):37===t&&n.getTarget("prev");n.flexAnimate(a,n.vars.pauseOnAction)}}),n.vars.mousewheel&&n.bind("mousewheel",function(e,t,a,i){e.preventDefault();var r=t<0?n.getTarget("next"):n.getTarget("prev");n.flexAnimate(r,n.vars.pauseOnAction)}),n.vars.pausePlay&&f.pausePlay.setup(),n.vars.slideshow&&n.vars.pauseInvisible&&f.pauseInvisible.init(),n.vars.slideshow&&(n.vars.pauseOnHover&&n.hover(function(){n.manualPlay||n.manualPause||n.pause()},function(){n.manualPause||n.manualPlay||n.stopped||n.play()}),n.vars.pauseInvisible&&f.pauseInvisible.isHidden()||(n.vars.initDelay>0?n.startTimeout=setTimeout(n.play,n.vars.initDelay):n.play())),m&&f.asNav.setup(),s&&n.vars.touch&&f.touch(),(!p||p&&n.vars.smoothHeight)&&$(window).bind("resize orientationchange focus",f.resize),n.find("img").attr("draggable","false"),setTimeout(function(){n.vars.start(n)},200)},asNav:{setup:function(){n.asNav=!0,n.animatingTo=Math.floor(n.currentSlide/n.move),n.currentItem=n.currentSlide,n.slides.removeClass(i+"active-slide").eq(n.currentItem).addClass(i+"active-slide"),r?(t._slider=n,n.slides.each(function(){var e=this;e._gesture=new MSGesture,e._gesture.target=e,e.addEventListener("MSPointerDown",function(e){e.preventDefault(),e.currentTarget._gesture&&e.currentTarget._gesture.addPointer(e.pointerId)},!1),e.addEventListener("MSGestureTap",function(e){e.preventDefault();var t=$(this),a=t.index();$(n.vars.asNavFor).data("flexslider").animating||t.hasClass("active")||(n.direction=n.currentItem<a?"next":"prev",n.flexAnimate(a,n.vars.pauseOnAction,!1,!0,!0))})})):n.slides.on(o,function(e){e.preventDefault();var t=$(this),a=t.index(),r;r=n.vars.rtl?-1*(t.offset().right-$(n).scrollLef
|
||
|
|
||
|
window.SEMICOLON_flexSliderInit = function( $flexSliderEl ){
|
||
|
|
||
|
$flexSliderEl = $flexSliderEl.filter(':not(.customjs)');
|
||
|
|
||
|
if( $flexSliderEl.length < 1 ){
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
$flexSliderEl.each(function() {
|
||
|
let element = $(this),
|
||
|
elLazy = element.find('.lazy'),
|
||
|
elAnimation = element.attr('data-animation') || 'slide',
|
||
|
elEasing = element.attr('data-easing') || 'swing',
|
||
|
elDirection = element.attr('data-direction') || 'horizontal',
|
||
|
elReverse = element.attr('data-reverse'),
|
||
|
elSlideshow = element.attr('data-slideshow'),
|
||
|
elPause = element.attr('data-pause') || 5000,
|
||
|
elSpeed = element.attr('data-speed') || 600,
|
||
|
elVideo = element.attr('data-video'),
|
||
|
elPagi = element.attr('data-pagi'),
|
||
|
elArrows = element.attr('data-arrows'),
|
||
|
elArrowLeft = element.attr('data-arrow-left') || 'icon-angle-left',
|
||
|
elArrowRight = element.attr('data-arrow-right') || 'icon-angle-right',
|
||
|
elThumbs = element.attr('data-thumbs'),
|
||
|
elHover = element.attr('data-hover'),
|
||
|
elSheight = element.attr('data-smooth-height'),
|
||
|
elTouch = element.attr('data-touch'),
|
||
|
elUseCSS = false;
|
||
|
|
||
|
if( elEasing == 'swing' ) {
|
||
|
elEasing = 'swing';
|
||
|
elUseCSS = true;
|
||
|
}
|
||
|
if( elReverse == 'true' ) { elReverse = true; } else { elReverse = false; }
|
||
|
if( !elSlideshow ) { elSlideshow = true; } else { elSlideshow = false; }
|
||
|
if( !elVideo ) { elVideo = false; }
|
||
|
if( elSheight == 'false' ) { elSheight = false; } else { elSheight = true; }
|
||
|
if( elDirection == 'vertical' ) { elSheight = false; }
|
||
|
if( elPagi == 'false' ) { elPagi = false; } else { elPagi = true; }
|
||
|
if( elThumbs == 'true' ) { elPagi = 'thumbnails'; } else { elPagi = elPagi; }
|
||
|
if( elArrows == 'false' ) { elArrows = false; } else { elArrows = true; }
|
||
|
if( elHover == 'false' ) { elHover = false; } else { elHover = true; }
|
||
|
if( elTouch == 'false' ) { elTouch = false; } else { elTouch = true; }
|
||
|
|
||
|
element.find('.flexslider').flexslider({
|
||
|
selector: ".slider-wrap > .slide",
|
||
|
animation: elAnimation,
|
||
|
easing: elEasing,
|
||
|
direction: elDirection,
|
||
|
reverse: elReverse,
|
||
|
slideshow: elSlideshow,
|
||
|
slideshowSpeed: Number(elPause),
|
||
|
animationSpeed: Number(elSpeed),
|
||
|
pauseOnHover: elHover,
|
||
|
video: elVideo,
|
||
|
controlNav: elPagi,
|
||
|
directionNav: elArrows,
|
||
|
smoothHeight: elSheight,
|
||
|
useCSS: elUseCSS,
|
||
|
touch: elTouch,
|
||
|
start: function( slider ){
|
||
|
SEMICOLON.widget.animations();
|
||
|
SEMICOLON.initialize.lightbox({ 'parent': element });
|
||
|
$('.flex-prev').html('<i class="'+ elArrowLeft +'"></i>');
|
||
|
$('.flex-next').html('<i class="'+ elArrowRight +'"></i>');
|
||
|
setTimeout( function(){
|
||
|
if( slider.parents( '.grid-container.has-init-isotope' ).length > 0 ) {
|
||
|
slider.parents( '.grid-container.has-init-isotope' ).isotope('layout');
|
||
|
}
|
||
|
}, 1200 );
|
||
|
if( typeof skrollrInstance !== "undefined" ) {
|
||
|
skrollrInstance.refresh();
|
||
|
}
|
||
|
},
|
||
|
after: function( slider ){
|
||
|
if( slider.parents( '.grid-container.has-init-isotope' ).length > 0 ) {
|
||
|
slider.parents( '.grid-container.has-init-isotope' ).isotope('layout');
|
||
|
}
|
||
|
$('.menu-item:visible').find( '.flexslider .slide' ).resize();
|
||
|
}
|
||
|
});
|
||
|
|
||
|
$(window).on( 'lazyLoadLoaded', function(){
|
||
|
if( elLazy.length == element.find('.lazy.lazy-loaded').length ) {
|
||
|
lazyLoadInstance.update();
|
||
|
setTimeout( function(){
|
||
|
element.find('.flexslider').resize();
|
||
|
}, 500 );
|
||
|
}
|
||
|
});
|
||
|
|
||
|
});
|
||
|
|
||
|
};
|
||
|
|