(function($){ $.fn.slideJ = function(options){ var defaults = {//默认属性 width:$(this).width(), height:$(this).height(), nav:".slideNav", leftBtn:".slideLeft", rightBtn:".slideRight", speed:200, time:4000, type:"opacity" } var options = $.extend(defaults,options);//参数合并 var sildeElem = $(this),//滑动模块 slideCl = sildeElem.find("li"), slideNavCl = $(options.nav).find("a"), total = slideCl.size(),//图片数量 nowNum = 1, active = false; if(total<=1){return;}//数量小于等于1不做操作 //整体CSS设置 $(this).css({ "position":"relative", "height":options.height, "width":options.width }); //取消A标签虚线框 var aHideFocus = options.nav+" a"+","+options.leftBtn+" a,"+options.rightBtn+" a,"+options.leftBtn+","+options.rightBtn; $(aHideFocus).attr("hideFocus","hideFocus"); this.each(function(){//分发轮换效果 switch(options.type){ case "opacity": opacityAnimateJ(options); break; case "slide": slideAnimateJ(options); break; default: break; }; }); //------------淡入淡出---------------------- function opacityAnimateJ(){ $(sildeElem).find("ul").css({ position:"relative", height:options.height, width:options.width, overflow:"hidden" }); slideCl.css({ position:"absolute" }); slideNavCl.eq(0).addClass("selected"); slideCl.css({opacity:0,"z-index":"0"}); slideCl.eq(0).css({opacity:1,"z-index":"1"}); var interval = setInterval(checkNum,options.time); slideNavCl.each(function(index){ $(this).click(function(){ if(active==true){ return; } nowNum = index; checkNum(); clearInterval(interval); interval = setInterval(checkNum,options.time); }); }); $(options.rightBtn).click(function(){ if(active==true){ return; } clearInterval(interval); checkNum(); interval = setInterval(checkNum,options.time); }); $(options.leftBtn).click(function(){ if(active==true){ return; } clearInterval(interval); var nx = nowNum-2; var cx=0; if(nx==-1){ nx = total-1; cx = 0; }else if(nx==-2){ nx = total-2; cx = total-1; }else{ cx=nx+1; } toggle_scroll(nx); nowNum = cx; interval = setInterval(checkNum,options.time); }); function checkNum(){ if(nowNum div").eq(a); // } ////$("#go_left").click(function(){ // $("div.hpt_04_con_flow").prepend( GD(-1) ); // $("div.hpt_04_con_flow").prepend( GD(-1) ); // $("#hpt_04_con_flow").css("left","-2064px"); // $("#hpt_04_con_flow").animate({left:'-1032px'}); // });//$("#go_right").click(function(){ // $("div.hpt_04_con_flow").append( GD(0) ); // $("div.hpt_04_con_flow").append( GD(0) ); // $("#hpt_04_con_flow").css("left","0px"); // $("#hpt_04_con_flow").animate({left:'-1032px'}); // });//});//生产现场翻页效果 function hptJs(n) { var len = 4; for (var i = 1; i <= len; i++) { document.getElementById('hptJ_a' + i).style.display = (i == n) ? 'block' : 'none'; document.getElementById('hptJ_' + i).className = (i == n) ? 'aaa' : 'none'; } } //jishucanshu