$(function(){ /*二级导航*/ var timer = null, funH = function(){ timer = window.setTimeout(function(){ $(".nav_yj>li").removeClass("on"); $(".nav_ej").hide(); }, 500); }; //延时计时器 var timer1 = null, funS = function(){ timer1 = window.setTimeout(function(){ $(".nav_ej>li").removeClass("on"); $(".nav_sj").hide(); }, 500); }; //延时计时器 $(".nav_yj>li").mouseenter(function(){ window.clearTimeout(timer); $(".nav_yj>li").removeClass("on"); $(this).addClass("on"); $(".nav_yj>li>.nav_ej").stop().hide("800"); $(this).children(".nav_ej").stop().show("800"); }).mouseleave(funH); $(".nav_ej>li").mouseenter(function(){ window.clearTimeout(timer1); $(".nav_ej>li").removeClass("on"); $(this).addClass("on"); $(".nav_ej>li>.nav_sj").stop().hide("800"); $(this).children(".nav_sj").stop().show("800"); }).mouseleave(funS); $(".nav_ej>li").each(function(){ if($(this).find(".nav_sj").length>0){ $(this).addClass("has"); } }); /*轮播*/ var H2=$(".banner-bg").width()*0.29; $(".banner-bg").css("height",H2); var W3=$(".banner-bg .btn").width()/2; $(".banner-bg .btn").css("margin-right",-W3); //list新闻列表左侧选择 var _href=window.location.pathname; var h2 = $(".local>a:last-child").attr("href"); $(".menu>ul>li").each(function(){ var h = $(this).children("a").attr("href"); var h3="http://"+ window.location.host + h; /*alert(h3);*/ if(_href==h || h3==h2 ){ $(".menu>ul>li").removeClass("on"); $(this).addClass("on"); } }); //试题页点击处答案效果 $(".con_con .shiti").each(function(){ var obj = $(this); $(obj).click(function(){ $(obj).find("span").show(); }); }); }); /*图片向左滚动*/ function leftImg(id1,id2,id3,speed){ if(speed){ var speed = speed; }else{ var speed=50; } var str=document.getElementById(id1); var str1=document.getElementById(id2); var str2=document.getElementById(id3); str2.innerHTML=str1.innerHTML; function Marquee(){ if(str2.offsetWidth-str.scrollLeft<=0) str.scrollLeft-=str1.offsetWidth else{ str.scrollLeft++; } } var MyMar=setInterval(Marquee,speed); str.onmouseover=function() {clearInterval(MyMar)}; str.onmouseout=function() {MyMar=setInterval(Marquee,speed)}; }