/** * @author 愚人码头 */ (function($){ $.fn.Slide=function(options){ var opts = $.extend({},$.fn.Slide.deflunt,options); var index=1; var targetLi = $("." + opts.claNav + " li", $(this));//目标对象 var clickNext = $("." + opts.claNav + " .next", $(this));//点击下一个按钮 var clickPrev = $("." + opts.claNav + " .prev", $(this));//点击上一个按钮 var ContentBox = $("." + opts.claCon , $(this));//滚动的对象 var ContentBoxNum=ContentBox.children().size();//滚动对象的子元素个数 var slideH=ContentBox.children().first().height();//滚动对象的子元素个数高度,相当于滚动的高度 var slideW=ContentBox.children().first().width();//滚动对象的子元素宽度,相当于滚动的宽度 var autoPlay; var slideWH; if(opts.effect=="scroolY"||opts.effect=="scroolTxt"){ slideWH=slideH; }else if(opts.effect=="scroolX"||opts.effect=="scroolLoop"){ ContentBox.css("width",ContentBoxNum*slideW); slideWH=slideW; }else if(opts.effect=="fade"){ ContentBox.children().first().css("z-index","1"); } return this.each(function() { var $this=$(this); //滚动函数 var doPlay=function(){ $.fn.Slide.effect[opts.effect](ContentBox, targetLi, index, slideWH, opts); index++; if (index*opts.steps >= ContentBoxNum) { index = 0; } }; clickNext.click(function(event){ $.fn.Slide.effectLoop.scroolLeft(ContentBox, targetLi, index, slideWH, opts,function(){ for(var i=0;i