;(function($){$.fn.marquee=function(options){return this.each(function(){var o=$.extend({},$.fn.marquee.defaults,options),$this=$(this),$marqueewrapper,containerwidth,animationcss,verticaldir,elwidth,loopcount=3,playstate='animation-play-state',css3animationissupported=false,_prefixedevent=function(element,type,callback){var pfx=["webkit","moz","ms","o",""];for(var p=0;p');var $el=$this.find('.js-marquee').css({'margin-right':o.gap,'float':'left'});if(o.duplicated){$el.clone(true).appendto($this);} $this.wrapinner('
');$marqueewrapper=$this.find('.js-marquee-wrapper');if(verticaldir){var containerheight=$this.height();$marqueewrapper.removeattr('style');$this.height(containerheight);$this.find('.js-marquee').css({'float':'none','margin-bottom':o.gap,'margin-right':0});if(o.duplicated)$this.find('.js-marquee:last').css({'margin-bottom':0});var elheight=$this.find('.js-marquee:first').height()+o.gap;if(o.startvisible&&!o.duplicated){o._completeduration=((parseint(elheight,10)+parseint(containerheight,10))/parseint(containerheight,10))*o.duration;o.duration=(parseint(elheight,10)/parseint(containerheight,10))*o.duration;}else{o.duration=((parseint(elheight,10)+parseint(containerheight,10))/parseint(containerheight,10))*o.duration;}}else{elwidth=$this.find('.js-marquee:first').width()+o.gap;containerwidth=$this.width();if(o.startvisible&&!o.duplicated){o._completeduration=((parseint(elwidth,10)+parseint(containerwidth,10))/parseint(containerwidth,10))*o.duration;o.duration=(parseint(elwidth,10)/parseint(containerwidth,10))*o.duration;}else{o.duration=((parseint(elwidth,10)+parseint(containerwidth,10))/parseint(containerwidth,10))*o.duration;}} if(o.duplicated){o.duration=o.duration/2;} if(o.allowcss3support){var elm=document.body||document.createelement('div'),animationname='marqueeanimation-'+math.floor(math.random()*10000000),domprefixes='webkit moz o ms khtml'.split(' '),animationstring='animation',animationcss3str='',keyframestring='';if(elm.style.animation){keyframestring='@keyframes '+animationname+' ';css3animationissupported=true;} if(css3animationissupported===false){for(var i=0;i2){$marqueewrapper.css('transform','translatey('+(o.direction=='up'?0:'-'+elheight+'px')+')');} animationcss={'transform':'translatey('+(o.direction=='up'?'-'+elheight+'px':0)+')'};}else if(o.startvisible){if(loopcount===2){if(animationcss3str){animationcss3str=animationname+' '+o.duration/1000+'s '+o.delaybeforestart/1000+'s '+o.css3easing;} animationcss={'transform':'translatey('+(o.direction=='up'?'-'+elheight+'px':containerheight+'px')+')'};loopcount++;}else if(loopcount===3){o.duration=o._completeduration;if(animationcss3str){animationname=animationname+'0';keyframestring=$.trim(keyframestring)+'0 ';animationcss3str=animationname+' '+o.duration/1000+'s 0s infinite '+o.css3easing;} _repositionvertically();}}else{_repositionvertically();animationcss={'transform':'translatey('+(o.direction=='up'?'-'+($marqueewrapper.height())+'px':containerheight+'px')+')'};}}else{if(o.duplicated){if(loopcount>2){$marqueewrapper.css('transform','translatex('+(o.direction=='left'?0:'-'+elwidth+'px')+')');} animationcss={'transform':'translatex('+(o.direction=='left'?'-'+elwidth+'px':0)+')'};}else if(o.startvisible){if(loopcount===2){if(animationcss3str){animationcss3str=animationname+' '+o.duration/1000+'s '+o.delaybeforestart/1000+'s '+o.css3easing;} animationcss={'transform':'translatex('+(o.direction=='left'?'-'+elwidth+'px':containerwidth+'px')+')'};loopcount++;}else if(loopcount===3){o.duration=o._completeduration;if(animationcss3str){animationname=animationname+'0';keyframestring=$.trim(keyframestring)+'0 ';animationcss3str=animationname+' '+o.duration/1000+'s 0s infinite '+o.css3easing;} _repositionhorizontally();}}else{_repositionhorizontally();animationcss={'transform':'translatex('+(o.direction=='left'?'-'+elwidth+'px':containerwidth+'px')+')'};}} $this.trigger('beforestarting');if(css3animationissupported){$marqueewrapper.css(animationstring,animationcss3str);var keyframecss=keyframestring+' { 100% '+_objtostring(animationcss)+'}',$styles=$marqueewrapper.find('style');if($styles.length!==0){$styles.filter(":last").html(keyframecss);}else{$('head').append('');} _prefixedevent($marqueewrapper[0],"animationiteration",function(){$this.trigger('finished');});_prefixedevent($marqueewrapper[0],"animationend",function(){animate();$this.trigger('finished');});}else{$marqueewrapper.animate(animationcss,o.duration,o.easing,function(){$this.trigger('finished');if(o.pauseoncycle){_startanimationwithdelay();}else{animate();}});} $this.data('runningstatus','resumed');};$this.bind('pause',methods.pause);$this.bind('resume',methods.resume);if(o.pauseonhover){$this.bind('mouseenter',methods.pause);$this.bind('mouseleave',methods.resume);} if(css3animationissupported&&o.allowcss3support){animate();}else{_startanimationwithdelay();}});};$.fn.marquee.defaults={allowcss3support:true,css3easing:'linear',easing:'linear',delaybeforestart:1000,direction:'left',duplicated:false,duration:5000,gap:20,pauseoncycle:false,pauseonhover:false,startvisible:false};})(jquery);