// javascript document /** * tab切换类库 */ tabclass = function (config) { this.tabname = config.tabname; //tab的名称前缀 this.cntname = config.cntname; //tab的内容前缀 this.number = config.number; //tab的个数 this.tabshowcls = config.tabshowcls;//活动的tab的class if (config.tabhiddencls) this.tabhiddencls = config.tabhiddencls;//非活动的tab的class else this.tabhiddencls = ''; if (config.cntshowcss) this.cntshowcss = config.cntshowcss;//非活动的tab的内容的样式 else this.cntshowcss = 'block'; this.show = function(index){ for (var i=0; i 6) $('#'+this.tabname+'_'+i).addclass(this.tabshowcls[1]); else $('#'+this.tabname+'_'+i).addclass(this.tabshowcls[0]); $('#'+this.cntname+'_'+i).css('display', this.cntshowcss); } } } } //热门商品百叶窗效果绑定 tabpro = function (config){ this.tabname = config.tabname; //tab的名称前缀 this.cntname = config.cntname; //tab的内容前缀 this.number = config.number; //tab的个数 this.tabshowcls = config.tabshowcls; //tab的选定样式 this.show_king_id = 1; this.show = function(index){ if(this.show_king_id == index) return true; $("#"+this.tabname+"_"+this.show_king_id).removeclass(this.tabshowcls); $('#'+this.cntname+'_'+this.show_king_id).css('display', 'none'); $("#"+this.tabname+"_"+index).addclass(this.tabshowcls); $('#'+this.cntname+'_'+index).css('display', 'inline-block'); this.show_king_id = index; } } /** * 图片幻灯切换类库 */ var switchpic = function (args) { this.bigpiccont = args.bigpic ; this.switchnav = args.switchnav ; this.selectstyle = args.selectstyle ; this.objname = args.objname ; var index = 0 ; this.autotimeintval = 3000 ; var selectstyle=this.selectstyle; var bigpics = $("#"+this.bigpiccont +" div"); var len=bigpics.length; var myswitchnav = $("#"+ this.switchnav +" li"); var autotimeintval = this.autotimeintval; var adtimer; bigpics.hide(); myswitchnav.mouseover(function(){ bigpics.hide(); index=myswitchnav.index(this); myswitchnav.removeclass(selectstyle); clearinterval(adtimer); bigpics.eq(index).show(); index=index+1; }).eq(0).mouseover(); index=1; myswitchnav.mouseout(function(){adtimer = setinterval(function(){ if(index==len){index=0;} showimg(index,bigpics,myswitchnav,selectstyle); index++; } , autotimeintval)}); $("#"+this.bigpiccont).hover(function(){ clearinterval(adtimer); },function(){adtimer = setinterval(function(){ showimg(index,bigpics,myswitchnav,selectstyle); index++; if(index==len){index=0;} } , autotimeintval);}).trigger("mouseleave"); } function showimg(index,bigpics,myswitchnav,selectstyle){ bigpics.hide(); bigpics.eq(index).show(); myswitchnav.removeclass(selectstyle).eq(index).addclass(selectstyle); }