$(function(){ $(".nav_child_ul").hide(); $(".nav_child_cover").hide(); /**首页**/ //导航切换 var $nav_li=$(".nav_li>a"); $nav_li.each(function(index, element) { $(this).hover(function(){ $nav_li.parent().removeclass("nav_now"); $(".nav_child_ul").hide(); $(this).parent().addclass("nav_now"); $(this).siblings(".nav_child_ul").show(); $(".nav_child_cover").show(); },function(){}) }); $(".nav_child_cover,.nav_child_ul").hover(function(){},function(){ $(".nav_child_ul").parent().removeclass("nav_now"); $(".nav_child_ul").hide(); $(".nav_child_cover").hide(); }) //大图切换 changp(0); var $div_img=$(".img>div>a"); $div_img.each(function(index, element) { $(this).click(function(){ changp(index); cleartimeout(tmid); }) }); //大图鼠标移上停止轮播,移开时开始轮播 $(".img>a").hover(function(){ cleartimeout(tmid); },function(){ tmid =settimeout("changp(cpindex)",8000); }); $div_img.hover(function(){ cleartimeout(tmid); },function(){ tmid =settimeout("changp(cpindex)",8000); }); //焦点图切换 changjd(0); var $jd_nav=$(".pic_nav i"); $jd_nav.each(function(index, element) { $(this).hover(function(){ changjd(index); cleartimeout(jd_tmid); },function(){ jd_tmid =settimeout("changjd(jd_index)",5000); }); }); //焦点图鼠标移上轮播停止 $(".pics .pic_a").hover(function(){ cleartimeout(jd_tmid); },function(){ jd_tmid =settimeout("changjd(jd_index)",5000); }); //集团动态和通知公告列表导航切换 $("#lc01>p>a").each(function(index, element) { $(this).hover(function(){ $(this).addclass("nav_now").siblings("a").removeclass("nav_now"); $(this).siblings("span").find("a").attr("href", $(this).attr("href")); $(this).parent("p").siblings("ul").hide().eq(index).show(); },function(){}); }); //商投产业和媒体聚焦列表导航切换 $("#lc02>p>a").each(function(index, element) { $(this).hover(function(){ $(this).addclass("nav_now").siblings("a").removeclass("nav_now"); $(this).siblings("span").find("a").attr("href", $(this).attr("href")); $(this).parent("p").siblings("ul").hide().eq(index).show(); },function(){}); }); //深化改革和党群工作导航切换 $("#lc03>p>a").each(function(index, element) { $(this).hover(function(){ $(this).addclass("nav_now").siblings("a").removeclass("nav_now"); $(this).siblings("span").find("a").attr("href", $(this).attr("href")); $(this).parent("p").siblings("ul").hide().eq(index).show(); },function(){}); }); //文化活动和通知公告切换 $("#lc04>p>a").each(function(index, element) { $(this).hover(function(){ $(this).addclass("nav_now").siblings("a").removeclass("nav_now"); $(this).siblings("span").find("a").attr("href", $(this).attr("href")); $(this).parent("p").siblings("ul").hide().eq(index).show(); },function(){}); }); }) /*首页大图切换*/ var cpindex=0; var tmid; function changp(index){ cleartimeout(tmid); var $img_sy=$(".img_sy"); var $img_bt=$(".img>div img"); //图片变换 $img_sy.eq(index).stop().slidedown("300").siblings(".img_sy").stop().slideup("300"); //按钮切换 $img_bt.each(function(index, element) { $(this).attr("src", $(this).attr("src").replace("now","")); }); var nowpngsrc=$img_bt.eq(index).attr("src"); nowpngsrc=nowpngsrc.split(".png")[0]; $img_bt.eq(index).attr("src",nowpngsrc+'now.png'); //按钮变换 index++; if(index>=7){ index=0; } cpindex=index; tmid =settimeout("changp(cpindex)",8000); } /*焦点图切换*/ var jd_index=0; var jd_tmid; function changjd(_index){ cleartimeout(jd_tmid); var $jd_img=$(".pic_a"); var $jd_tit=$(".pic_tit a"); var $jd_nav=$(".pic_nav i"); //图片变换 $jd_img.eq(_index).stop().fadein().siblings(".pic_a").hide(); //标题变换 $jd_tit.eq(_index).stop().slidedown().siblings("a").hide(); //按钮切换 $jd_nav.eq(_index).addclass("pic_new_now").siblings("i").removeclass("pic_new_now"); //按钮变换 _index++; if(_index>=$jd_img.length){ _index=0; } jd_index=_index; jd_tmid =settimeout("changjd(jd_index)",5000); }