/*! Yondslider - v1.0.0 - 2011-08-05 * http://yond.com.br/slider * Copyright (c) 2013 Felipe Rohde; Licensed MIT */ !function(a){a.fn.YondSlider=function(b){function c(a,b){for(var c=0;c0&&r.length>0&&(c.defaultYondInner>1&&(x=x+1-c.defaultYondInner),1==c.keyboard&&(a(document).bind("keydown",function(b){-1==a(b.target).parents().index(c.innerSlider)}),a(document).keydown(function(a){return 39==a.keyCode&&x>0?(x--,n.move(1),!1):37==a.keyCode&&x>=0&&w>x?(x++,n.move(-1),!1):void 0})),c.scroll&&a(o).mousewheel(function(b,d){if(a(this).trigger(c.event),d>0){if(x>=0&&w>x)return x++,n.move(-1),!1;a(this).parents(".theyond").prev().trigger(c.event)}else if(0>d){if(x>0)return x--,n.move(1),!1;a(this).parents(".theyond").next().trigger(c.event)}}),s.click(function(){return x++,n.move(-1),!1}),r.click(function(){return x--,n.move(1),!1})),null!=c.rand&&0!=c.rand&&a(c.innerSlider).hover(n.stop,n.start),c.pager&&t.length>0&&a("a",t).click(g)}function f(){if(c.controls&&(s.toggleClass("disable",!(k>0)),r.toggleClass("disable",!(j>k+1))),c.pager){var b=a(".pagenum",t);b.removeClass("activeslide"),a(b[k]).addClass("activeslide")}}function g(){return a(this).hasClass("pagenum")&&(x=w-parseInt(this.rel),n.move(parseInt(this.rel),!0)),!1}function h(){c.rand&&!m&&a(o).hasClass("Yrand")&&(clearTimeout(l),l=setTimeout(function(){k=k+1==j?-1:k,u=k+1==j?!1:0==k?!0:u,n.move(u?1:-1),x=w-k},c.randtime+30*Math.random()))}var i,j,k,l,m,n=this,o=a(".door",b).first(),p=a(".view",b).first(),q=p.children(),r=a(".next",b).first(),s=a(".prev",b).first(),t=a(".pager",b).first(),u=!0,v=0==c.hubVerticalInner,w=a(p).find(c.iListMarker).size()-1,x=w;return this.stop=function(){clearTimeout(l),m=!0},this.start=function(){m=!1,h()},this.move=function(b,d){if(a(c.iListMarker,this).find(".Ycaption")&&c.caption&&a(".Ycaption").stop().delay(c.durationInner+120).css({opacity:0}).animate({marginTop:10,opacity:1},{duration:200}).animate({marginTop:0,opacity:1},{duration:200}),k=d?b:k+=b,k>-1&&j>k){var e={};e[v?"left":"top"]=-(k*i*c.display),p.animate(e,{queue:!1,easing:c.easingInner,duration:c.animation?c.durationInner:0,complete:function(){"function"==typeof c.callbackInner&&c.callbackInner.call(this,q[k],k)}}),f(),h()}},d()}var f={event:"click",easing:"easeInOutCirc",easingInner:"easeOutExpo",hubVertical:!1,hubVerticalInner:!1,scroll:!1,keyboard:!1,pagerOver:!0,caption:!0,pin:!0,defaultYond:null,defaultYondInner:1,spacing:1,duration:400,durationInner:800,pager:!0,animation:!0,rand:"[all]",OutRand:!1,randtime:4e3,display:1,controls:!0,innerSlider:".slider",outSlider:this,iListMarker:"dt",callback:null,callbackInner:null},g=a.extend(f,b),h=g.hubVertical?"height":"width",k=g.hubVertical?"top":"left",l=a(g.innerSlider).size();a.fn.Ystart=function(){a(g.innerSlider,g.outSlider).data("ynd").start()},a.fn.Ystop=function(){a(g.innerSlider,g.outSlider).data("ynd").stop()},a.fn.Ymove=function(b){a(g.innerSlider,g.outSlider).data("ynd").move(b-1,!0)},a.fn.YOmove=function(b){a(g.innerSlider).eq(b).trigger(g.event).addClass("active")},a.fn.YOnext=function(){var b=a(".active").index();b==l-1?a(".theyond").eq(0).trigger(g.event,[!0]):a(".theyond.active").next().trigger(g.event,[!0])},a.fn.YOprev=function(){var b=a(".active").index();0==b?a(".theyond").eq(l-1).trigger(g.event,[!0]):a(".theyond.active").prev().trigger(g.event,[!0])},g.OutRand&&d(),a(g.outSlider).find(".pagenum").click(function(){var b=a(this).parents("theyond").parent().parent();return a(b).hasClass("active")||a(b).trigger(g.event,[!0]),!1}),a(".buttons",g.outSlider).click(function(){a(this).parent().trigger(g.event,[!0])}),g.outSlider.each(function(){box=a(this);var b=box.children("div"),d=b.eq(0).css(h).replace(/px/,"");g.max?g.min=(d*b.size()-g.max)/(b.size()-1):g.max=d*b.size()-g.min*(b.size()-1),g.hubVertical?box.css({width:b.eq(0).css("width"),height:d*b.size()+g.spacing*(b.size()-1)+"px"}):box.css({width:d*b.size()+g.spacing*(b.size()-1)+"px",height:b.eq(0).css("height")});var e=[];for(i=0;i=j?j*g.min:(j-1)*g.min+g.max)+j*g.spacing;b.each(function(f){(c(g.rand,a(this).index()+1)||"all"==g.rand||"[all]"==g.rand||1==g.rand)&&a(this).find(".door").addClass("Yrand");var i=a(this);0===f?i.css(k,"0px"):f==b.size()-1?i.css(g.hubVertical?"bottom":"right","0px"):(i.css(k,f*d+f*g.spacing),null!=g.defaultYond?i.css(k,e[g.defaultYond-1][f]):i.css(k,f*d+f*g.spacing)),null!=g.defaultYond&&(g.defaultYond-1==f?(i.css(h,g.max+"px"),i.addClass("active")):(i.css(h,g.min+"px"),i.removeClass("active"))),i.css({margin:0,position:"absolute"}),i.bind(g.event,function(){var c=[],d=[];for(b.stop().removeClass("active"),b.find(".verticalTitle").removeClass("activeTitle"),i.find(".buttons").css("display","none"),j=0;j0&&a1?a(this).data("ynd",new e(a(this),g)):g.scroll&&a(this).mousewheel(function(b,c){return a(this).trigger(g.event),a(this).parent().hasClass("active")?(c>0&&a(this).parent().prev().trigger(g.event),0>c&&a(this).parent().next().trigger(g.event)):!a(this).parent().hasClass("scrolled"),!1})})}}(jQuery);