// JavaScript Document $(document).ready(function(){ //////////////////////////////////////////////////////////////////////产品列表交互 var timerPro = null; var psLiHeight = $("#ps_ul .ps_title").height()+33; $(".ps_list").height(psLiHeight*3); $("#down").hover(function(){ $(this).attr("src","images/p_arror_down.jpg"); },function(){ $(this).attr("src","images/p_arror_down.jpg"); }); $("#up").hover(function(){ $(this).attr("src","images/p_arror_up1.jpg"); },function(){ $(this).attr("src","images/p_arror_up.jpg"); }); $("#down").click(function(){ var psIndex = $(".currentLi").index()+1; if(psIndex==$("#ps_ul>li").length-3){ psIndex = 0 ; } $("#ps_ul").animate({top:-psLiHeight*psIndex+'px'}); $("#ps_ul>li").eq(psIndex).addClass("currentLi").siblings().removeClass("currentLi"); psIndex++; }); $("#up").click(function(){ var psIndex=$(".currentLi").index(); psIndex--; if(psIndex==-1){ psIndex = $("#ps_ul>li").length-4 ; } $("#ps_ul").animate({top:-psLiHeight*psIndex+'px'}); $("#ps_ul>li").eq(psIndex).addClass("currentLi").siblings().removeClass("currentLi"); }); timerPro=setInterval(function(){ var psIndex = $(".currentLi").index()+1; if(psIndex==$("#ps_ul>li").length-3){ psIndex = 0 ; } $("#ps_ul").animate({top:-psLiHeight*psIndex+'px'}); $("#ps_ul>li").eq(psIndex).addClass("currentLi").siblings().removeClass("currentLi"); psIndex++; },5000); $(".ps_list").hover(function(){ clearInterval(timerPro); },function(){ timerPro=setInterval(function(){ var psIndex = $(".currentLi").index()+1; if(psIndex==$("#ps_ul>li").length-3){ psIndex = 0 ; } $("#ps_ul").animate({top:-psLiHeight*psIndex+'px'}); $("#ps_ul>li").eq(psIndex).addClass("currentLi").siblings().removeClass("currentLi"); psIndex++; },5000); }); });