/*! * Lush Content Slider * http://geedmo.com * * Version: 1.7.3 * Author: @geedmo * Copyright (c) 2014, Geedmo. All rights reserved. * Released under CodeCanyon Regular License: http://codecanyon.net/licenses * * News: http://codecanyon.net/user/geedmo/portfolio * ======================================================= */ (function($,window,document,undefined){$.fn.forceReflow=function(){return this.each(function(){var reflow=this.offsetWidth})};$.fn.clearState=function(state){return this.removeClass((this.data("activeClass")||"")+" "+state+" live")};$.fn.prepareEffect=function(duration,easing){return this.each(function(){var $this=$(this),animation={};if($this.css($.support.css3feature.animation.name+"FillMode")==="both"){animation[$.support.css3feature.animation.name+"Duration"]=duration+"ms";animation[$.support.css3feature.animation.name+"TimingFunction"]=easing;$this.clearTransition().css(animation)}else{var transition={};transition[$.support.css3feature.transition.name+"Property"]="all";transition[$.support.css3feature.transition.name+"Duration"]=duration+"ms";transition[$.support.css3feature.transition.name+"TimingFunction"]=easing;transition[$.support.css3feature.transition.name+"Delay"]="0s";$this.css(transition)}})};$.fn.clearTransition=function(){var cleared={};cleared[$.support.css3feature.transition.name+"Duration"]="0s";cleared[$.support.css3feature.transition.name]="none";return this.css(cleared)};var pluginName="lush",sliderClass="lush-slider",flexsliderClass="flexslider",containerClass="lush",classPrev="lush-prev",classNext="lush-next",classPage="lush-page",classNav="lush-nav",classShadow="lush-shadow",classExternal="lush-external",sliderData="lushSlider",flexsliderData="lushFlexslider",fadeMargin=50;function Lush(element,option){$.support.css3feature=function(){var b=document.createElement("lush"),d=function(){var f={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},e;for(e in f){if(b.style[e]!==undefined){return{end:f[e],name:e}}}}(),c=function(){var f={WebkitAnimation:"webkitAnimationEnd",MozAnimation:"animationend",OAnimation:"oAnimationEnd",MSAnimation:"MSAnimationEnd",animation:"animationend"},e;for(e in f){if(b.style[e]!==undefined){return{end:f[e],name:e}}}}();b=null;return(d||c)&&{transition:d,animation:c}}();$.data(element,pluginName,this);this.container=$(element);this.elements=this.container.children().not(".ignore, .lush-nav");this.options=option;this.options.manual=false;this.container.height(this.container.width()/(this.options.baseWidth/this.options.baseHeight));this.sliding=false;this.stopped=false;this.paused=false;this.outRendered=false;this.options.deadtime=isNaN(parseInt(this.options.deadtime))?0:parseInt(this.options.deadtime);if(!this.options.isSlider&&this.options.carousel)this.options.carousel=false;this.cssEasing={linear:"linear",swing:"ease-out",ease:"ease","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out",snap:"cubic-bezier(0,1,.5,1)",easeOutCubic:"cubic-bezier(.215,.61,.355,1)",easeInOutCubic:"cubic-bezier(.645,.045,.355,1)",easeInCirc:"cubic-bezier(.6,.04,.98,.335)",easeOutCirc:"cubic-bezier(.075,.82,.165,1)",easeInOutCirc:"cubic-bezier(.785,.135,.15,.86)",easeInExpo:"cubic-bezier(.95,.05,.795,.035)",easeOutExpo:"cubic-bezier(.19,1,.22,1)",easeInOutExpo:"cubic-bezier(1,0,0,1)",easeInQuad:"cubic-bezier(.55,.085,.68,.53)",easeOutQuad:"cubic-bezier(.25,.46,.45,.94)",easeInOutQuad:"cubic-bezier(.455,.03,.515,.955)",easeInQuart:"cubic-bezier(.895,.03,.685,.22)",easeOutQuart:"cubic-bezier(.165,.84,.44,1)",easeInOutQuart:"cubic-bezier(.77,0,.175,1)",easeInQuint:"cubic-bezier(.755,.05,.855,.06)",easeOutQuint:"cubic-bezier(.23,1,.32,1)",easeInOutQuint:"cubic-bezier(.86,0,.07,1)",easeInSine:"cubic-bezier(.47,0,.745,.715)",easeOutSine:"cubic-bezier(.39,.575,.565,1)",easeInOutSine:"cubic-bezier(.445,.05,.55,.95)",easeInBack:"cubic-bezier(0.6,-0.28,0.735,0.045)",easeOutBack:"cubic-bezier(.175, .885,.32,1.275)",easeInOutBack:"cubic-bezier(.68,-.55,.265,1.55)"};this.container.css({visibility:"hidden"});if(this.options.isSlider)this.container.hide();this.preload(this.container,$.proxy(this.init,this))}Lush.prototype={init:function(){var prevTimeOut=0,prevTimeIn=0,oldDisplay,self=this;if(!this.container.hasClass("lush"))this.container.addClass("lush");this.container.css({visibility:"visible"});this.updatePos();if(this.options.flexslider){oldDisplay=this.container.css("display");this.container.show()}if(this.options.isSlider)this.container.show();$.each(this.elements,$.proxy(function(i,element){var e=this.elements[i].$el=$(element),origin;e.slideIn={};e.slideOut={};origin=e.data("slide-in")||self.container.data("slide-in");if(origin)e.dataIn=origin.split(" ");e.slideIn.at=parseInt(this.get("at",e.dataIn));e.slideIn.from=this.get("from",e.dataIn);e.slideIn.use=this.get("use",e.dataIn);e.slideIn.during=parseInt(this.get("during",e.dataIn));e.slideIn.plus=parseInt(this.get("plus",e.dataIn));e.slideIn.force=this.get("force",e.dataIn);if(!this.cssEasing[e.slideIn.use])e.slideIn.use="linear";if(e.slideIn.plus>0)e.slideIn.at+=e.slideIn.plus+prevTimeIn;prevTimeIn=e.slideIn.at;origin=e.data("slide-out")||self.container.data("slide-out");if(origin){e.dataOut=origin.split(" ");e.slideOut.at=parseInt(this.get("at",e.dataOut));e.slideOut.to=this.get("to",e.dataOut);e.slideOut.use=this.get("use",e.dataOut);e.slideOut.during=parseInt(this.get("during",e.dataOut));e.slideOut.plus=parseInt(this.get("plus",e.dataOut));e.slideOut.force=this.get("force",e.dataOut);if(!this.cssEasing[e.slideOut.use])e.slideOut.use="linear";if(e.slideOut.plus>0)e.slideOut.at+=e.slideOut.plus+prevTimeOut;prevTimeOut=e.slideOut.at}e.css({position:"absolute"});e=null},this));this.saveSize();if(this.options.flexslider)this.container.css("display",oldDisplay);if(this.options.isSlider)this.container.hide();if(this.options.carousel)this.container.parent().data("from-direction",this.options.direction);if(this.options.autostart)this.start();self.runHook("onInit");this.container.trigger("lushInit");$(window).resize($.proxy(this.resize,this))},get:function(prop,data){var pos=$.inArray(prop,data);if(pos<0)return this.options.param[prop];return data[pos+1]||!data[pos+1]},renderIn:function(){var self=this,isInverted=this.carouselInvert(),elementCount=this.elements.length;this.container.addClass("running");this.elements.each($.proxy(function(index,element){var el=element.$el;el.clearQueue();el.delay(parseInt(isInverted?self.elements[--elementCount].$el.slideIn.at:el.slideIn.at));this.from(el);el.queue(function(){self.runHook("onItemSlideIn",el);$(this).dequeue()});if(index==this.elements.length-1){el.queue(function(){self.runHook("onSlideIn");self.container.trigger("slideIn");$(this).dequeue()})}if(this.options.deadtime>0&&!el.slideOut.force)el.delay(this.options.deadtime);if($.support.css3feature)el.show()},this));return this},renderOut:function(){var self=this,isInverted=this.carouselInvert(),elementCount=this.elements.length;this.outRendered=true;this.outStarted=false;this.elements.each($.proxy(function(index,element){var el=element.$el,interval;if(el.slideOut.at>=0){el.delay(parseInt(isInverted?self.elements[--elementCount].$el.slideOut.at:el.slideOut.at));el.queue(function(){if(self.paused&&!el.slideOut.force&&!self.outStarted)interval=setInterval($.proxy(function(){if(!self.paused){clearInterval(interval);$(this).dequeue()}},this),50);else{$(this).dequeue();if(!el.slideOut.force)self.outStarted=true}});this.to(el);el.queue(function(){self.runHook("onItemSlideOut",el);$(this).dequeue()});if(index==this.elements.length-1){el.queue(function(){self.runHook("onSlideOut");self.container.trigger("slideOut");$(this).dequeue()})}}},this));return this},start:function(){var self=this;if(this.sliding)return;this.sliding=true;this.container.show();this.container.addClass("active");this.resize();self.runHook("onSlide");this.container.trigger("slideStart");this.renderIn();if(!this.options.manual){this.renderOut()}this.end();if(this.options.carousel)this.container.parent().data("from-direction",this.options.direction)},end:function(halt){var that=this;$.when(this.elements).done($.proxy(function(){if(!this.outRendered){this.container.removeClass("running");return}this.outRendered=false;this.endslide(halt)},this));return this},endslide:function(halt){var self=this;this.sliding=false;self.runHook("onSlided");this.container.removeClass("active running").trigger("slideEnd");if(this.options.isSlider&&!this.stopped&&!halt)this.advance();this.stopped=false},advance:function(direction){var nextDirection=direction||this.options.direction,nextSlide;if(!this.sliding){nextSlide=nextDirection=="next"?this.options.syncNext:this.options.syncPrev;$(nextSlide).lush("start")}},preload:function(el,callback){var preSrc=[],imgcnt=0;this.container.find("*").each(function(i,el){var $this=$(el),bg,src;if($this[0].tagName==="IMG"){src={src:$this.attr("src"),tag:$this[0].tagName};preSrc.push(src)}else if($this[0].tagName==="IFRAME"){src={src:$this.attr("src"),tag:$this[0]};preSrc.push(src)}else{bg=$this.css("background-image");if(bg&&bg!=="none"&&bg.indexOf("url")>=0){src={src:bg.match(/url\((.*)\)/)[1].replace(/"/gi,""),tag:"IMG"};preSrc.push(src)}}});if(!preSrc.length){callback()}else{$.each(preSrc,function(i,src){if(src.tag==="IMG")$("<"+src.tag+">").load(function(){if(++imgcnt==preSrc.length)callback()}).attr("src",src.src);else $(src.tag).load(function(){if(++imgcnt==preSrc.length)callback()}).attr("src",src.src)})}},stop:function(){this.stopped=true;this.elements.each(function(i,element){while(element.$el.queue().length)element.$el.stop(false,!$.support.css3feature)});return this},go:function(direction){var that=this;if(this.options.carousel)this.container.parent().data("from-direction",direction);if(this.options.manual){if(this.outRendered)return;this.renderOut().end()}else{this.state("resume").stop().advance(direction)}},state:function(state){this.paused=state==="pause";if(this.paused)this.container.addClass("paused");else{this.container.removeClass("paused")}return this},size:function(){return{width:this.container.width(),height:this.container.height()}},hide:function(){this.elements.hide()},show:function(){this.elements.show()},saveSize:function(){var properties={};this.containerSize={width:this.options.baseWidth,height:this.options.baseHeight};this.elements.each(function(i,element){var $el=$(element);properties.fs=parseInt($el.css("font-size"),0)||0;properties.lh=parseInt($el.css("line-height"))||0;properties.pt=parseInt($el.css("paddingTop"),0)||0;properties.pb=parseInt($el.css("paddingBottom"),0)||0;properties.pl=parseInt($el.css("paddingLeft"),0)||0;properties.pr=parseInt($el.css("paddingRight"),0)||0;properties.mt=parseInt($el.css("marginTop"),0)||0;properties.mb=parseInt($el.css("marginBottom"),0)||0;properties.ml=parseInt($el.css("marginLeft"),0)||0;properties.mr=parseInt($el.css("marginRight"),0)||0;properties.btw=parseInt($el.css("borderTopWidth"),0)||0;properties.bbw=parseInt($el.css("borderBottomWidth"),0)||0;properties.blw=parseInt($el.css("borderLeftWidth"),0)||0;properties.brw=parseInt($el.css("borderRightWidth"),0)||0;properties.bts=$el.css("borderTopStyle");properties.bbs=$el.css("borderBottomStyle");properties.bls=$el.css("borderLeftStyle");properties.brs=$el.css("borderRightStyle");properties.btc=$el.css("borderTopColor");properties.bbc=$el.css("borderBottomColor");properties.blc=$el.css("borderLeftColor");properties.brc=$el.css("borderRightColor");properties.hg=parseInt($el.height())||properties.lh||0;properties.wd=parseInt($el.width())||0;properties.b=$el.css("bottom");properties.l=$el.css("left");properties.r=$el.css("right");$el.data("properties",$.extend({},properties))})},updatePos:function(){var self=this;this.elements.each(function(i,element){var $el=$(element);if(!self.isUnit(element.style.left,"%"))$el.css("left",parseFloat(element.style.left)*100/self.options.baseWidth+"%");if(!self.isUnit(element.style.top,"%"))$el.css("top",parseFloat(element.style.top)*100/self.options.baseHeight+"%")})},isUnit:function(value,unit){return value.indexOf(unit)>0||(unit=="px"||value=="auto")},resize:function(){var properties,ratio,$el;if(!this.containerSize)return;ratio=this.container.width()/this.containerSize.width;this.container.css({height:this.containerSize.height*ratio});if(this.options.isSlider||this.options.flexslider){this.container.parent().css({height:this.containerSize.height*ratio})}this.elements.each(function(i,element){$el=$(element);properties=$el.data("properties");if(!properties)return false;$el.css({"font-size":Math.floor(properties.fs*ratio)+"px","line-height":lhUnitless(Math.floor(properties.lh*ratio)),"padding-top":properties.pt*ratio+"px","padding-bottom":properties.pb*ratio+"px","padding-left":properties.pl*ratio+"px","padding-right":properties.pr*ratio+"px","border-top":properties.btw*ratio+"px "+properties.bts+" "+properties.btc,"border-bottom":properties.bbw*ratio+"px "+properties.bbs+" "+properties.bbc,"border-left":properties.blw*ratio+"px "+properties.bls+" "+properties.blc,"border-right":properties.brw*ratio+"px "+properties.brs+" "+properties.brc,height:properties.hg*ratio+"px",width:properties.wd*ratio+"px"});if(element.tagName==="IFRAME")$el.attr({width:properties.wd*ratio,height:properties.hg*ratio})});function lhUnitless(val){return val<1?1:val+"px"}},carouselInvert:function(){var fromdir=this.container.parent().data("from-direction");return this.options.carousel&&fromdir&&fromdir!==this.options.direction},from:function(el){var objFrom,objTo,justFade=false,self=this,effect;effect=this.carouselInvert()?el.slideOut.to:el.slideIn.from;if($.support.css3feature){el.clearTransition().clearState("out").addClass("in").data("activeClass",effect).addClass(effect);el.prepareEffect(el.slideIn.during,self.cssEasing[el.slideIn.use]).queue(function(){this.offsetWidth;$(this).addClass("live").dequeue()}).delay(parseInt(el.slideIn.during)-100)}else{switch(effect){case"left":case"l":objFrom={"margin-left":-this.container.width(),"margin-top":0};objTo={"margin-left":0};break;case"right":case"r":objFrom={"margin-left":this.container.width(),"margin-top":0};objTo={"margin-left":0};break;case"top":case"t":objFrom={"margin-top":-this.container.height(),"margin-left":0};objTo={"margin-top":0};break;case"bottom":case"b":objFrom={"margin-top":this.container.height(),"margin-left":0};objTo={"margin-top":0};break;case"left-fade":case"lf":objFrom={"margin-left":-fadeMargin,opacity:0,"margin-top":0};objTo={"margin-left":0,opacity:1};break;case"right-fade":case"rf":objFrom={"margin-left":fadeMargin,opacity:0,"margin-top":0};objTo={"margin-left":0,opacity:1};break;case"top-fade":case"tf":objFrom={"margin-top":-fadeMargin,opacity:0,"margin-left":0};objTo={"margin-top":0,opacity:1};break;case"bottom-fade":case"bf":objFrom={"margin-top":fadeMargin,opacity:0,"margin-left":0};objTo={"margin-top":0,opacity:1};break;default:justFade=true;break}if(justFade){el.css("margin",0).hide().fadeTo(parseInt(el.slideIn.during),1)}else{el.css(objFrom).show().animate(objTo,{duration:parseInt(el.slideIn.during),easeing:el.slideIn.use})}}return{from:objFrom,to:objTo}},to:function(el){var objTo,objFrom,justFade=false,self=this,effect;effect=this.carouselInvert()?el.slideIn.from:el.slideOut.to;if($.support.css3feature){el.queue(function(){$(this).clearState("in").addClass("out").data("activeClass",effect).addClass(effect).prepareEffect(el.slideOut.during,self.cssEasing[el.slideOut.use]).dequeue()});el.queue(function(){this.offsetWidth;$(this).addClass("live").dequeue()});el.delay(parseInt(el.slideOut.during)-100)}else{switch(effect){case"left":case"l":objFrom={"margin-left":0};objTo={"margin-left":-this.container.width()};break;case"right":case"r":objFrom={"margin-left":0};objTo={"margin-left":this.container.width()};break;case"top":case"t":objFrom={"margin-top":0};objTo={"margin-top":-this.container.height()};break;case"bottom":case"b":objFrom={"margin-top":0};objTo={"margin-top":this.container.height()};break;case"left-fade":case"lf":objTo={"margin-left":-fadeMargin,opacity:0};objFrom={"margin-left":0,opacity:1};break;case"right-fade":case"rf":objTo={"margin-left":fadeMargin,opacity:0};objFrom={"margin-left":0,opacity:1};break;case"top-fade":case"tf":objTo={"margin-top":-fadeMargin,opacity:0};objFrom={"margin-top":0,opacity:1};break;case"bottom-fade":case"bf":objTo={"margin-top":fadeMargin,opacity:0};objFrom={"margin-top":0,opacity:1};break;default:justFade=true;break}if(justFade){el.fadeOut(parseInt(el.slideOut.during))}else{el.animate(objTo,{duration:parseInt(el.slideOut.during),easing:el.slideOut.use})}}return{to:objTo}},runHook:function(name,ctx,params){ctx=ctx||this.container;params=params||[];this.options["_"+name]&&this.options["_"+name].apply(ctx,params);this.options[name]&&this.options[name].apply(ctx,params)}};function Slider(element,option){this.container=$(element);this.items=this.container.children("li, .lush");this.itemCount=this.items.length;this.loopCount=0;this.options=option.slider;this.lush=option;if(this.options.startAt<0||this.options.startAt>=this.itemCount)this.options.startAt=0;this.lush.isSlider=true;this.container.height(this.container.width()/(this.lush.baseWidth/this.lush.baseHeight));this.sliding=false;this.options.manual=this.options.manual||this.lush.manual;if(this.options.manual)this.options.pauseOnHover=false;if(this.options.deadtime>0)this.lush.deadtime=this.options.deadtime;this.preloader();this.prepareVideos($.proxy(function(){this.preload($.proxy(this.init,this))},this))}Slider.prototype={init:function(){var slideNext,slidePrev,initCounter=0,that=this;this.items.one("lushInit",function(){if(++initCounter==that.itemCount){that.addstuff();that.activePage(1);that.container.trigger("sliderInit")}});this.items.eq(this.options.startAt).one("lushInit",function(){$(this).lush("start");that.preloader(true)});this.items.each($.proxy(function(i,el){$(el).data("slide-index",i+1);slideNext=i+1;slidePrev=i-1;if(i==this.itemCount-1)slideNext=0;if(i==0)slidePrev=this.itemCount-1;$(el).width(this.container.width()).lush($.extend(this.lush,{autostart:false,slider:true,flexslider:false,carousel:!!this.options.carousel,syncNext:this.items[slideNext],syncPrev:this.items[slidePrev],_onSlide:function(){that.activePage(this.data("slide-index"));if(that.options.manual){this.lush("pause")}else{if(that.loopEnds.call(that)){this.lush("pause");that.container.off(".lushhover").trigger("sliderLoopEnd")}}},_onSlideIn:function(){if(that.options.manual){this.removeClass("running")}},_onSlided:function(){this.children(".lush-video-wrapper").each(function(){that.resetVideo($(this))})},_onItemSlideIn:function(){if(that.options.videoAutoplay){if(this.hasClass("lush-video-wrapper")){this.click()}}}}))},this))},preloader:function(remove){if(remove){this.container.children(".lush-preloader").remove()}else{this.container.append($("
",{"class":"lush-preloader"}))}},prepareVideos:function(callback){var that=this,videos=[],videoLen=0,videoCnt=0;this.items.find('iframe[src*="player.vimeo"]').each(function(){videoLen=videos.push({iframe:$(this),type:"vm"})});this.items.find('iframe[src*="www.youtu"]').each(function(){videoLen=videos.push({iframe:$(this),type:"yt"})});if(videoLen==0){callback();return}for(var i=0;i