/* @extends jquery v1.10.2 * @fileoverview 鑷?鍔ㄥ吋瀹筆c绔?銆佺щ鍔ㄧ??鐨勫浘鐗囧惊鐜?婊氬姩鎻掍欢 * @email 122452357@qq.com * @version v3.0 * @date 2016-01-05 * @remark wang yunhong -- the love of my life. * copyright (c) 2015-2016 澶╂动娴呭敱, 璇峰皧閲嶅姵鍔ㄦ垚鏋滐紝鑻ョ洿鎺ヤ娇鐢ㄨ?锋敞鏄庡嚭澶勶紝璋㈣阿锛? * @example * $("slider").yuxislider(); * @parameter{ width:瀹瑰櫒瀹藉害, height:瀹瑰櫒楂樺害, control:鎺у埗鎸夐挳锛孭c绔?鍙?浼犲叆鎺у埗鎸夐挳瀵硅薄锛岀щ鍔ㄧ??鏃犳寜閽? auto:鏄?鍚﹁嚜鍔ㄦ挱鏀? 榛樿?よ嚜鍔?(true), during:闂撮殧鏃堕棿, speed:鍥剧墖婊戝姩閫熷害, mousewheel:鏄?鍚﹀紑鍚?榧犳爣婊戣疆 榛樿?ゅ惁(false), direkey:鏄?鍚︾粦瀹氭柟鍚戦敭 榛樿?ゅ惁(false) } */ !function(a){a.fn.extend({yuxislider:function(b){var c={width:350,height:290,control:null,auto:!0,during:3e3,speed:800,mousewheel:!1,direkey:!1},d=a.extend(c,b);return a(this).each(function(){var b=a(this),c=a("ul",b),e=a("li",b),f=e.length,g=0,h=null,i='

';b.append(i);var j=a("p.title a",b),k=a("em.curr-num",b),l=a("em.total-num",b),m=0,n={},o={},p={mobiledevice:navigator.useragent.match(/(iphone|ipod|android|ios)/i),init:function(){if(p.style(),p.mobiledevice){var e=a(window).width(),g=d.width/d.height;d.width=e,d.height=e/g,b.css({fontsize:a(window).width()/350*1.285+"rem"})}b.add("img",b).width(d.width).height(d.height),c.width(f*d.width),p.description(),p.bindcontrol(),f>2&&c.prepend(a("li",c).last()).css({left:-d.width}),d.auto&&p.auto()},auto:function(){h=d.auto?setinterval(function(){p.moving(!0)},d.during):null},stop:function(){h&&clearinterval(h)},description:function(){k.text(g+1),l.text(f),j.text(e.eq(g).find("img").attr("alt")).attr("href",e.eq(g).find("a").attr("href")).width(d.width-a("span.num",b).width()-20)},bindcontrol:function(){if(p.mobiledevice){if(d.control&&d.control.remove(),2>=f)return;c.get(0).addeventlistener("touchstart",p.touchstart,!1),c.get(0).addeventlistener("touchmove",p.touchmove,!1),c.get(0).addeventlistener("touchend",p.touchend,!1)}else{b.hover(function(){d.auto&&p.stop(),a(document).on("keydown",function(a){a.preventdefault(),(39===a.keycode||40===a.keycode)&&p.moving(!0),(37===a.keycode||38===a.keycode)&&p.moving(!1)})},function(){a(document).unbind(),d.auto&&p.auto()});var e=void 0!==document.mozhidden?"dommousescroll":"mousewheel";d.mousewheel&&b.onclick(e,function(a){a.preventdefault(),a.stoppropagation();var c=a.originalevent.wheeldelta?a.originalevent.wheeldelta:-a.originalevent.detail,d=b.data("timeoutid");d&&clearinterval(d),b.data("timeoutid",settimeout(function(){p.moving(0>c?!0:!1),b.removedata("timeoutid")},100))}),d.control&&d.control.on("click",function(){p.moving(a(this).index()?!0:!1)}).hover(function(){d.auto&&p.stop()},function(){d.auto&&p.auto()})}},moving:function(b){if(1!=f){var e=0,h=!0;"boolean"==typeof b?h=b:(h=b>0?!1:!0,e=b),g=h?g>=f-1?0:g+1:0>=g?f-1:g-1,p.description(),f>2?(h?c.append(a("li",c).first()).css({left:0+e}):c.prepend(a("li",c).last()).css({left:-2*d.width+e}),c.stop().animate({left:[-d.width,"easeoutexpo"]},d.speed)):h?c.stop().animate({left:-d.width},.6*d.speed,function(){a(this).append(a("li",this).first()).css({left:0})}):c.prepend(a("li",c).last()).css({left:-d.width+e}).stop().animate({left:0},.6*d.speed)}},touchpos:function(a){for(var c,d,e,b=a.changedtouches,f={},g=0;g=e?p.moving(b):math.abs(b)<=d.width/2?c.stop().animate({left:[o.left,"easeoutexpo"]},d.speed/2):p.moving(b),d.auto&&p.auto())},style:function(){b.css({position:"relative",overflow:"hidden"}).fadein(450),e.css({display:"inline","float":"left"}),c.add(a(".bg",b)).add(a(".desc",b)).add(a(".num",b)).css({position:"absolute"}),a(".bg",b).css({background:"#000",filter:"alpha(opacity=50)",opacity:.5}).add(a(".desc",b)).css({width:"100%",height:"3em",bottom:0,left:0}),a(".desc").css({zindex:2}),a("p.title",b).css({"float":"left",height:"1em",padding:"1em .5em",fontfamily:"microsoft yahei"}),a("p.title a",b).css({display:"block",color:"#fff",textoverflow:"ellipsis",whitespace:"nowrap",overflow:"hidden"}),a("span.num",b).css({right:".5em",color:"#fff",fontstyle:"italic",fontfamily:'georgia, "monotype corsiva", arial, sans-serif'}),a("em",b).css({display:"inline-block",position:"relative"}),a("em.curr-num",b).css({fontsize:"2.4em",height:"2em",lineheight:"2em",color:"#cc191b",bottom:".625em"}),a("em.total-num",b).css({fontsize:"1.2em",height:"2em",lineheight:"2em",top:".6em"}),a("em.line",b).css({width:"16px",height:"3em",background:"url(images/splash_white.png) center no-repeat"})}};p.init()})}})}(jquery),$.extend($.easing,{easeoutexpo:function(a,b,c,d,e){return b==e?c+d:d*(-math.pow(2,-10*b/e)+1)+c}});