/*导航*/ $(document).ready(function(){ $("li").each(function(){ var thespan = $(this); var themenu = thespan.find(".submenu"); var tarheight = themenu.height(); themenu.css({height:0,opacity:0}); var t1; function expand() { cleartimeout(t1); thespan.find('a').addclass("selected"); themenu.stop().show().animate({height:tarheight,opacity:1},200); } function collapse() { cleartimeout(t1); t1 = settimeout(function(){ thespan.find('a').removeclass("selected"); themenu.stop().animate({height:0,opacity:0},200,function(){ $(this).css({display:"none"}); }); }, 250); } thespan.hover(expand, collapse); themenu.hover(expand, collapse); }); }); //焦点图开始 $(function() { var swidth = $("#focus").width(); //获取焦点图的宽度(显示面积) var len = $("#focus dd li").length; //获取焦点图个数 var index = 0; var pictimer; //以下代码添加数字按钮和按钮后的半透明条,还有上一页、下一页两个按钮 var btn = "
"; for(var i=0; i < len; i++) { btn += ""; } btn += "
"; $("#focus").append(btn); $("#focus .btnbg").css("opacity",0.5); //为小按钮添加鼠标滑入事件,以显示相应的内容 $("#focus .btn span").css("opacity",0.4).mouseenter(function() { index = $("#focus .btn span").index(this); showpics(index); }).eq(0).trigger("mouseenter"); //上一页、下一页按钮透明度处理 $("#focus .prenext").css("opacity",0.2).hover(function() { $(this).stop(true,false).animate({"opacity":"0.5"},300); },function() { $(this).stop(true,false).animate({"opacity":"0.2"},300); }); //上一页按钮 $("#focus .pre").click(function() { index -= 1; if(index == -1) {index = len - 1;} showpics(index); }); //下一页按钮 $("#focus .next").click(function() { index += 1; if(index == len) {index = 0;} showpics(index); }); //本例为左右滚动,即所有li元素都是在同一排向左浮动,所以这里需要计算出外围dd元素的宽度 $("#focus dd").css("width",swidth * (len)); //鼠标滑上焦点图时停止自动播放,滑出时开始自动播放 $("#focus").hover(function() { clearinterval(pictimer); },function() { pictimer = setinterval(function() { showpics(index); index++; if(index == len) {index = 0;} },4000); //此4000代表自动播放的间隔,单位:毫秒 }).trigger("mouseleave"); //显示图片函数,根据接收的index值显示相应的内容 function showpics(index) { //普通切换 var nowleft = -index*swidth; //根据index值计算dd元素的left值 $("#focus dd").stop(true,false).animate({"left":nowleft},300); //通过animate()调整dd元素滚动到计算出的position //$("#focus .btn span").removeclass("on").eq(index).addclass("on"); //为当前的按钮切换到选中的效果 $("#focus .btn span").stop(true,false).animate({"opacity":"0.4"},300).eq(index).stop(true,false).animate({"opacity":"1"},300); //为当前的按钮切换到选中的效果 } }); // javascript document //案例图片滚动列表 mengjia 070927 var speed_1 = 8; //速度(毫秒) var space_1 = 12; //每次移动(px) var pagewidth_1 = 239 * 2; //翻页宽度 var interval_1 = 4000; //翻页间隔 var fill_1 = 0; //整体移位 var movelock_1 = false; var movetimeobj_1; var moveway_1="right"; var comp_1 = 0; var autoplayobj_1=null; function getobj(objname){if(document.getelementbyid){return eval('document.getelementbyid("'+objname+'")')}else{return eval('document.all.'+objname)}} function autoplay_1(){clearinterval(autoplayobj_1);autoplayobj_1=setinterval('isl_godown_1();isl_stopdown_1();',interval_1)} function isl_goup_1(){if(movelock_1)return;clearinterval(autoplayobj_1);movelock_1=true;moveway_1="left";movetimeobj_1=setinterval('isl_scrup_1();',speed_1);} function isl_stopup_1(){if(moveway_1 == "right"){return};clearinterval(movetimeobj_1);if((getobj('isl_cont_1').scrollleft-fill_1)%pagewidth_1!=0){comp_1=fill_1-(getobj('isl_cont_1').scrollleft%pagewidth_1);compscr_1()}else{movelock_1=false} autoplay_1()} function isl_scrup_1(){if(getobj('isl_cont_1').scrollleft<=0){getobj('isl_cont_1').scrollleft=getobj('isl_cont_1').scrollleft+getobj('list1_1').offsetwidth} getobj('isl_cont_1').scrollleft-=space_1} function isl_godown_1(){clearinterval(movetimeobj_1);if(movelock_1)return;clearinterval(autoplayobj_1);movelock_1=true;moveway_1="right";isl_scrdown_1();movetimeobj_1=setinterval('isl_scrdown_1()',speed_1)} function isl_stopdown_1(){if(moveway_1 == "left"){return};clearinterval(movetimeobj_1);if(getobj('isl_cont_1').scrollleft%pagewidth_1-(fill_1>=0?fill_1:fill_1+1)!=0){comp_1=pagewidth_1-getobj('isl_cont_1').scrollleft%pagewidth_1+fill_1;compscr_1()}else{movelock_1=false} autoplay_1()} function isl_scrdown_1(){if(getobj('isl_cont_1').scrollleft>=getobj('list1_1').scrollwidth){getobj('isl_cont_1').scrollleft=getobj('isl_cont_1').scrollleft-getobj('list1_1').scrollwidth} getobj('isl_cont_1').scrollleft+=space_1} function compscr_1(){if(comp_1==0){movelock_1=false;return} var num,tempspeed=speed_1,tempspace=space_1;if(math.abs(comp_1)tempspace){comp_1-=tempspace;num=tempspace}else{num=comp_1;comp_1=0} getobj('isl_cont_1').scrollleft+=num;settimeout('compscr_1()',tempspeed)}} function picrun_ini(){ getobj("list2_1").innerhtml=getobj("list1_1").innerhtml; getobj('isl_cont_1').scrollleft=fill_1>=0?fill_1:getobj('list1_1').scrollwidth-math.abs(fill_1); getobj("isl_cont_1").onmouseover=function(){clearinterval(autoplayobj_1)} getobj("isl_cont_1").onmouseout=function(){autoplay_1()} autoplay_1(); } //产品展示滚动图片结束 function mm_jumpmenu(targ,selobj,restore){ //v3.0 eval(targ+".location='"+selobj.options[selobj.selectedindex].value+"'"); if (restore) selobj.selectedindex=0; } function mm_preloadimages() { //v3.0 var d=document; if(d.images){ if(!d.mm_p) d.mm_p=new array(); var i,j=d.mm_p.length,a=mm_preloadimages.arguments; for(i=0; i0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i 2) { if ((img = mm_findobj(args[2])) != null && !img.mm_init) { img.mm_init = true; img.mm_up = args[3]; img.mm_dn = img.src; if ((nbarr = document[grpname]) == null) nbarr = document[grpname] = new array(); nbarr[nbarr.length] = img; for (i=4; i < args.length-1; i+=2) if ((img = mm_findobj(args[i])) != null) { if (!img.mm_up) img.mm_up = img.src; img.src = img.mm_dn = args[i+1]; nbarr[nbarr.length] = img; } } } else if (event == "over") { document.mm_nbover = nbarr = new array(); for (i=1; i < args.length-1; i+=3) if ((img = mm_findobj(args[i])) != null) { if (!img.mm_up) img.mm_up = img.src; img.src = (img.mm_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.mm_up); nbarr[nbarr.length] = img; } } else if (event == "out" ) { for (i=0; i < document.mm_nbover.length; i++) { img = document.mm_nbover[i]; img.src = (img.mm_dn) ? img.mm_dn : img.mm_up; } } else if (event == "down") { nbarr = document[grpname]; if (nbarr) for (i=0; i < nbarr.length; i++) { img=nbarr[i]; img.src = img.mm_up; img.mm_dn = 0; } document[grpname] = nbarr = new array(); for (i=2; i < args.length-1; i+=2) if ((img = mm_findobj(args[i])) != null) { if (!img.mm_up) img.mm_up = img.src; img.src = img.mm_dn = (args[i+1])? args[i+1] : img.mm_up; nbarr[nbarr.length] = img; } } } //qq浮动 lastscrolly=0; function heartbeat(){ var diffy; if (document.documentelement && document.documentelement.scrolltop) diffy = document.documentelement.scrolltop; else if (document.body) diffy = document.body.scrolltop else {/*netscape stuff*/} percent=.1*(diffy-lastscrolly); if(percent>0)percent=math.ceil(percent); else percent=math.floor(percent); document.getelementbyid("full").style.top=parseint(document.getelementbyid("full").style.top)+percent+"px"; lastscrolly=lastscrolly+percent; } var suspendcode=document.getelementbyid("full") window.setinterval("heartbeat()",1); //关闭 function hideq(){ obj=document.getelementbyid("full"); obj.style.display='none'; } /** * 缓冲回到页面顶部 与qq悬浮共用 * @param acceleration 加速度 * @param time 时间间隔 (毫秒) **/ function gotop(acceleration, time) { acceleration = acceleration || 0.5; time = time || 10; var x1=0;var y1=0;var x2=0;var y2=0;var x3=0;var y3=0;if(document.documentelement){x1=document.documentelement.scrollleft||0;y1=document.documentelement.scrolltop||0}if(document.body){x2=document.body.scrollleft||0;y2=document.body.scrolltop||0}var x3=window.scrollx||0;var y3=window.scrolly||0;var x=math.max(x1,math.max(x2,x3));var y=math.max(y1,math.max(y2,y3));var speed=1+acceleration;window.scrollto(math.floor(x/speed),math.floor(y/speed));if(x>0||y>0){var invokefunction="gotop("+acceleration+", "+time+")";window.settimeout(invokefunction,time)}}