/** * 焦点图 主页 特卖页面使用 */ $(document).ready(function(){ var picTimer = null; var current = 0; function showPic(order) { //获取轮播的图片总个数 var size = $(".bd").find("li").length; clearInterval(picTimer); current = parseInt(current); if("undefined" == typeof(order)){ current = current + 1; }else if(1 == order){ current = current + 1; }else if(-1 == order){ current = current - 1; } if(current >= size){ current = 0; }else if(current < 0){ current = size - 1; } $(".bd").find("li").css({"opacity":0.3}).hide().eq(current).show(); $(".bd").find("li").eq(current).animate({"opacity":1},1200); picTimer = setInterval(showPic,5000); } $(".jPreOut").bind("click",function(event){ showPic(-1); }); $(".jNextOut").bind("click",function(event){ showPic(1); }); picTimer = setInterval(showPic,5000); });