$(function(){ var cur=0; //左侧年份 效果 $(".l_cont li:nth-child(4n)").addclass("a04"); $(".l_cont li:nth-child(4n-1)").addclass("a03"); $(".l_cont li:nth-child(4n-2)").addclass("a02"); $(".l_cont li:nth-child(4n-3)").addclass("a01") //定义数组 var shi=[[5,22,0,-500,450,308],[4,22,20,10,380,260],[3,18,70,300,280,192],[2,14,110,540,190,130],[1,10,120,750,120,82]] $(".l_cont li").each(function(i){ $(this).click(function(){ $(".event_0 .moon dl dd h4").each(function(ee){ $(".event_0 .moon dl dd h4").removeclass("on"); $(".moon .dlbox dd").removeclass("on"); if($(this).attr("date")==$(".l_cont li").eq(i).attr("date")) { $(this).addclass("on"); $(this).parent("dd").addclass("on") ; show_1(); return false; } }) $(".event_list li").hide(); $(".event_list li").eq(i).show(); $(".l_cont li").hide().css({zindex:0}); $(".l_cont li").eq(i).show().css({zindex:shi[1][0]}).animate({"fontsize":shi[1][1],"top":shi[1][2],"left":shi[1][3],width:shi[1][4],height:shi[1][5]}) $(".l_cont li").eq(i).find("img").animate({width:shi[1][4],height:shi[1][5]}) var b1,b2,b3,b4 b1=i-1; b2=i-2; b3=i-3; b4=i-4; b1<0?b1=100000:1; b2<0?b2=100000:1; b3<0?b3=100000:1; b4<0?b4=100000:1; $(".l_cont li").eq(b1).show().css({zindex:shi[0][0]}).stop().animate({"fontsize":shi[0][1],"top":shi[0][2],"left":shi[0][3],width:shi[0][4],height:shi[0][5]},function(){ }); $(".l_cont li").eq(b1).find("img").stop().animate({width:shi[0][4],height:shi[0][5]}) $(".l_cont li").eq(b2).show().css({zindex:shi[0][0]}).stop().animate({"fontsize":shi[0][1],"top":shi[0][2],"left":shi[0][3],width:shi[0][4],height:shi[0][5]},function(){ $(".l_cont li").eq(b2).prevall().css({zindex:shi[0][0],"fontsize":shi[0][1],"top":shi[0][2],"left":shi[0][3],width:shi[0][4],height:shi[0][5]}) }); $(".l_cont li").eq(b2).find("img").stop().animate({width:shi[0][4],height:shi[0][5]}) /* $(".l_cont li").eq(b3).show().css({zindex:shi[0][0]}).stop().animate({"fontsize":shi[0][1],"top":shi[0][2],"left":shi[0][3],width:shi[0][4],height:shi[0][5]},function(){ }); $(".l_cont li").eq(b3).find("img").stop().animate({width:shi[0][4],height:shi[0][5]}) $(".l_cont li").eq(b4).show().css({zindex:shi[0][0]}).stop().animate({"fontsize":shi[0][1],"top":shi[0][2],"left":shi[0][3],width:shi[0][4],height:shi[0][5]},function(){ }); $(".l_cont li").eq(b4).find("img").stop().animate({width:shi[0][4],height:shi[0][5]})*/ $(".l_cont li").eq(i+1).show().css({zindex:shi[2][0]}).stop().animate({"fontsize":shi[2][1],"top":shi[2][2],"left":shi[2][3],width:shi[2][4],height:shi[2][5]}); $(".l_cont li").eq(i+2).show().css({zindex:shi[3][0]}).stop().animate({"fontsize":shi[3][1],"top":shi[3][2],"left":shi[3][3],width:shi[3][4],height:shi[3][5]}); $(".l_cont li").eq(i+3).show().css({zindex:shi[4][0]}).stop().animate({"fontsize":shi[4][1],"top":shi[4][2],"left":shi[4][3],width:shi[4][4],height:shi[4][5]},function(){ $(".l_cont li").eq(i+3).nextall().css({zindex:shi[4][0],"fontsize":shi[4][1],"top":shi[4][2],"left":shi[4][3],width:shi[4][4],height:shi[4][5]}) }); //$(".l_cont li").eq(i+4).show().css({zindex:shi[4][0]}).stop().animate({"fontsize":shi[4][1],"top":shi[4][2],"left":shi[4][3],width:shi[4][4],height:shi[4][5]}); $(".l_cont li").eq(i+1).find("img").stop().animate({width:shi[2][4],height:shi[2][5]}) $(".l_cont li").eq(i+2).find("img").stop().animate({width:shi[3][4],height:shi[3][5]}) //$(".l_cont li").eq(i+3).find("img").stop().animate({width:shi[4][4],height:shi[4][5]}) //$(".l_cont li").eq(i+4).find("img").stop().animate({width:shi[4][4],height:shi[4][5]}) }); }) $(".l_cont li").eq(cur).click(); //年份 end $(".event_0 .per").click(function(){ cur++; cur>=$(".l_cont li").size()-1?cur=$(".l_cont li").size()-1:0; $(".l_cont li").eq(cur).click(); }) $(".event_0 .next").click(function(){ cur--; cur<=0?cur=0:0; $(".l_cont li").eq(cur).click(); }) $(".moon .dlbox h4").each(function(i){ $(this).click(function(){ var date0=$(this).attr("date") ; $(".l_cont li").each(function(q){ if($(this).attr("date")==date0) { $(".l_cont li").eq(q).click(); cur=q; return false; } }) }) }) $(".moon .dlbox .h3").click(function(){ $(".moon .dlbox dd").removeclass("on"); $(this).parent("dd").addclass("on") ; show_1(); }) //文字按钮上下滚动\ var parheight=$(".moon .dlbox dl").outerheight(); var parbox=$(".moon .dlbox").height(); var ptop=0 function show_1(){ parheight=$(".moon .dlbox dl").outerheight(); parbox=$(".moon .dlbox").height(); if(parheight>parbox) { $(".moon .aa").show(); } } show_1(); // 向下 $(".moon .down").click(function(){ if(parheight>parbox) { ptop=$(".moon .dlbox dl").position().top-100; if(ptop<-(parheight-parbox)) { ptop=-(parheight-parbox); } $(".moon .dlbox dl").stop().animate({top:ptop},200) } }) // 向上 $(".moon .up").click(function(){ if(parheight>parbox) { ptop=$(".moon .dlbox dl").position().top+100; if(ptop>0) { ptop=0; } $(".moon .dlbox dl").stop().animate({top:ptop},200) } }) //end $(".event_0").fadein(); })