$(function(){ var w=$(window).width(); var bh=w*669/1600; if(w<1600){ $("#banner").css({"width":"100%","height":bh+"px"}); $("#banner img").css({"width":"100%","height":bh+"px"}); } $(".tab a:first").addclass("active").siblings().removeclass("active"); $(".tabcontent .indexnews:first").show().siblings(".indexnews").hide(); $(".mainright dl dd").each(function(){ var index=$(this).index(); $(this).addclass("index"+index); }) $(".pages a:first").hide(); $(".newsnav a:last").addclass("active"); $(".process li:first").css({"background":"none","marginbottom":"0"}); $(".process li:nth-child(even)").addclass("pro-right"); $(".jyfzbox .menubox li:last").css("marginright","0"); $(".datetime a:last").css("height","24px"); $(".products li").each(function(){ if($(this).index()%4==3){ $(this).css("marginright","0") } }) var i=-1; $(".navbox li").each(function() { $(this).attr("index",i); i++; }); $(".navbox li").mouseenter(function(){ $(this).addclass("sucurrent"); var indexnum =$(this).attr("index"); var imghtml = $(this).parent("ul").siblings(".hideimg").children("dd").eq(indexnum).html(); $(this).find(".imgbox").html(imghtml); if($(this).find("dl").children("dd").length<=3){ $(this).find("dl").children("dd").css({"width":"30%","marginright":"4%"}); $(this).find("dl").children("dd:last").css("marginright","0"); $(this).find("dl").css("paddingtop","40px"); } //if($(this).find("dl").children("dd").length>4){ // $(this).find(".imgbox").css("marginright","60px"); // $(this).find("dl").css("width","750"); // $(this).find("dl").children("dd").css("marginright","43px"); // $(this).find("dl").children("dd:nth-child(even)").css("marginright","43px"); // $(this).find("dl").children("dd").each(function() { // if($(this).index()%4==3){ // $(this).css("marginright","0"); // } // }); //} if($(this).find(".subnav").find("dl").find("dd").length==""){ $(this).find(".subnav").hide(); $(this).parents().siblings(".bg").hide(); }else{ $(this).find(".subnav").show(); } $(this).parents().siblings(".bg").show(); }) $(".navbox li").mouseleave(function(){ $(this).removeclass("sucurrent"); $(this).find(".subnav").hide(); $(this).parents().siblings(".bg").hide(); }) $(".subnav dl dd:nth-child(even)").css("marginright","0"); $(".policy li").click(function(){ $(this).toggleclass("current"); $(this).children(".policy-text").toggle(); }) sethovermenu(); }) function sethovermenu(){ $(".tab a").hover(function(){ var index=$(this).index(); $(this).addclass("active").siblings().removeclass("active"); $(this).parent().siblings(".tabcontent").children(".indexnews").eq(index).show().siblings(".indexnews").hide(); }) }