function showpre(o){ var that= this; this.box = $("#"+o["box"]); this.btnp = $("#"+o.pre); this.btnn= $("#"+o.next); this.v = o.v||1; this.c = 0; var li_node = "li"; this.loop = o.loop||false; //循环生成dom if(this.loop){ this.li = this.box.find(li_node); this.box.append(this.li.eq(0).clone(true)); }; this.li = this.box.find(li_node); this.l = this.li.length; //滑动条件不成立 if(this.l<=this.v){ this.btnp.hide(); this.btnn.hide(); }; this.deinit = true; this.w = this.li.outerwidth(true); this.box.width(this.w*this.l); this.maxl = this.l - this.v; //要多图滚动 重新计算变量 this.s = o.s||1; if(this.s>1){ this.w = this.v*this.w; this.maxl = math.floor(this.l/this.v); this.box.width(this.w*(this.maxl+1)); //计算需要添加数量 var addnum = (this.maxl+1)*this.v-this.l; var addhtml = ""; for(var adn = 0;adn < addnum;adn++){ addhtml += "
  • "; }; this.box.append(addhtml); }; //生成状态图标 this.numico = null; if(o.numico){ this.numico = $("#"+o.numico); var numhtml = ""; numl = this.loop?(this.l-1):this.l; for(var i = 0;i"; }; this.numico.html(numhtml); this.numicoli = this.numico.find("a"); this.numicoli.bind("mousemove",function(){ if(that.c==$(this).html())return false; that.c=$(this).html(); that.move(); }); }; this.bigbox = null; this.loadnumbox = null; if(o.loadnumbox){ this.loadnumbox = $("#"+o.loadnumbox); }; //当前序号设置 this.allnumbox = null; if(o.loadnumbox){ this.allnumbox = $("#"+o.allnumbox); if(o.bbox){ var call = this.l<10?("0"+this.l):this.l; }else{ var call = this.maxl<10?("0"+(this.maxl+1)):(this.maxl+1); }; this.allnumbox.html(call); }; //大图按钮点击操作 if(o.bbox){ this.bigbox = $("#"+o.bbox); this.li.each(function(n){ $(this).attr("num",n); var cn = (n+1<10) ? ("0"+(n+1)):n+1; $(this).find(".text").html(cn); }); this.loadnum = 0; this.li.bind("click",function(){ if(that.loadnum==$(this).attr("num"))return false; var test = null; if(that.loadnum>$(this).attr("num")){ test = "pre"; }; that.loadnum = $(this).attr("num"); that.loadimg(test); }); that.loadimg(); if(o.bnext){ that.bnext = $("#"+o.bnext); that.bnext.bind("mousemove",function(){ that.loadnum 0? that.loadnum--:that.loadnum=that.l-1 ; that.loadimg("pre"); }); }; }; //滑动点击操作(循环or不循环) if(this.loop){ this.btnp.bind("mousemove",function(){ if(that.c<=0){ that.c = that.l-1; that.box.css({left:-that.c*that.w}); }; that.c --; that.move(1); }); this.btnn.bind("mousemove",function(){ if(that.c>=(that.l-1)){ that.box.css({left:0}); that.c = 0; }; that.c++; that.move(1); }); }else{ this.btnp.bind("mousemove",function(){ that.c> 0? that.c--:that.c=that.maxl ; that.move(1); }); this.btnn.bind("click",function(){ that.c
    "); }else{ if(test!="pre"){ var le = -1230; that.bigbox.append("
    "); }else{ var le = 1230; that.bigbox.find(".loading").before("
    "); that.bigbox.css({"margin-left":-1230}); le = 0; }; }; that.bigbox.animate({"margin-left":le},function(){ $(img).bind("load",function(){ //判断出现方向 if(test!="pre"){ var n = 1,oldn = 0; }else{ var n = 0,oldn = 1; }; that.bigbox.find(".loading").eq(n).html(img); that.bigbox.find(".loading").eq(oldn).remove(); that.bigbox.css({"margin-left":0}); $(this).fadein(200,function(){ if(bigth3){ $("#bigt").fadein() bigth3.html(that.li.eq(that.loadnum).attr("data-h")); }; if(bigth4){ $("#bigt").fadein() bigth4.html(that.li.eq(that.loadnum).attr("data-m")); }; if(bigtext){ bigtext.html(that.li.eq(that.loadnum).attr("data-text")).fadein(); }; }); }); img.src = _src; }); //添加当前加载序号 that.li.removeclass("on"); that.li.eq(that.loadnum).addclass("on"); if(that.loadnumbox){ var loadc = parseint(that.loadnum)+1; loadc = loadc<10?"0"+loadc:loadc; that.loadnumbox.html(loadc); }; }, autoplay:function(){ //自动播放方法 var that =this; that.timer = setinterval(function(){ that.c