$(function(){ set($("#settab1")); set($("#settab2")); set($("#settab3")); set($("#settab4")); set($("#settab5")); set($("#js_sevrmap")); set($("#js_tabpro")); set($("#js_tabstudy")); function set(obj){ var t=obj.find(".js_tabtit").children(); var c=obj.find(".js_tabcon").children(); var omore=obj.find(".js_tabmore").children(); c.css("display","none").eq(0).css("display","block"); t.hover(function(){ var index=$(this).index(); $(this).addclass("on").siblings().removeclass("on"); c.eq(index).show().siblings().hide(); omore.eq(index).show().siblings().hide(); }) } $("#js_toggle h5").eq(0).attr("class","arrow_down"); $("#js_toggle div").css("display","none"); $("#js_toggle div").eq(0).css("display","block"); $("#js_toggle h5").click(function(){ if($(this).hasclass("arrow_down")){ $(this).removeclass("arrow_down"); $(this).next("div").hide(); }else{ $(this).addclass("arrow_down"); $(this).next("div").show(); } }) $("#js_map .city_name div").click(function(){ var index=$(this).index(); $(this).parent().parent().find(".city").children("div").eq(index).show().siblings().hide(); $("#js_table_city").children("table").eq(index).show().siblings().hide(); }); $(".pro_model").children("div").click(function(evt){ var e=(evt)?evt:window.event; //判断浏览器的类型,在基于ie内核的浏览器中的使用cancelbubble //在基于firefox内核的浏览器中支持 stoppropagation e.stoppropagation ? e.stoppropagation():e.cancelbubble=true; $(this).children("ul").show().end().siblings().children("ul").hide(); }) $(".pro_model ul li").click(function(evt){ var e=(evt)?evt:window.event; //判断浏览器的类型,在基于ie内核的浏览器中的使用cancelbubble //在基于firefox内核的浏览器中支持 stoppropagation e.stoppropagation ? e.stoppropagation():e.cancelbubble=true; $(this).parent().parent().children("span").text($(this).text()); $(this).parent().hide(); }); $("body").click(function(){ $(".pro_model ul").hide(); }) // 导航 $(".subnav").siblings("a").each(function(index){ $(this).mouseover(function(){ $(this).addclass("hover"); $($(".subnav")[index]).show(); }).mouseout(function(){ $(".hover").removeclass("hover"); $($(".subnav")[index]).hide(); }); }); $(".subnav").each(function(index){ $(this).mouseover(function(){ $(this).show(); $($(".subnav").siblings("a")[index]).addclass("hover"); }).mouseout(function(){ $(this).hide(); $($(".subnav").siblings("a")[index]).removeclass("hover"); }); }); $(".gotop").click(function () { var speed=300;//滑动的速度 $('body,html').animate({ scrolltop: 0 }, speed); return false; }); })