/*定义两个变量,保存当前页码和上一页页码*/ |
// var $index=0; |
// var $exdex=0; |
//下一页的点击事件。在右移基础上加了最大index判断 |
// $(".next").click(function(){ |
// $index++; |
// if($index>2){ |
// $index=0 |
// } |
// $(".choose span").eq($index).addClass("red").siblings(). |
// removeClass("red"); |
// next(); |
// return $exdex=$index; |
// }); |
// //上一页的点击事件 |
// $(".pre").click(function(){ |
// $index--; |
// if($index<0){ |
// $index=2 |
// }; |
// $(".choose span").eq($index).addClass("red").siblings(). |
// removeClass("red"); |
// pre(); |
// return $exdex=$index; |
// }); |
//加个定时器,正常轮播 |
// var imgHeight=$('.top_banner a img').height(); |
// $('.top_banner').css('height',imgHeight+'px'); |
// function changeImg(){ |
// var atime=setInterval(function(){ |
// |
// $index++; |
// if($index>2){ |
// $index=0 |
// }; |
// |
// $(".next").click(); |
// $('.top_banner').mouseenter(function(){ |
// clearInterval(atime); |
// }); |
// next(); |
// return $exdex=$index; |
// },5000); |
// }; |
// |
// changeImg(); |
// $('.top_banner').mouseleave(function(){ |
// changeImg(); |
// }); |
// function next(){ |
// $(".top_banner a").eq($index).stop(true,true). |
// css("left","100%").animate({"left":"0"}); |
// $(".top_banner a").eq($exdex).stop(true,true). |
// css("left","0").animate({"left":"-100%"}); |
// } |
// function pre(){ |
// $(".top_banner a").eq($index).stop(true,true). |
// css("left","-100%").animate({"left":"0"}); |
// $(".top_banner a").eq($exdex).stop(true,true). |
// css("left","0").animate({"left":"100%"}); |
// } |