定时器关闭后再开启一般都会按照原来的路线继续走,不会因为你点了3而下个就会是4
$(".focus-rad>ul>li").hover(
function(){
$(this).css({"background-color":"red","opacity": "0.5"}).siblings("li").css({"background-color":"#000","opacity": "0.5"});
$(".focus-list>ul>li").eq($(this).index()).show().siblings("li").hide();
clearInterval(focusauto);
},function(){
m_index = $(this).index(); //关键
focusauto = setInterval(main_focus,3000);
});
只要在开启定时器之前,给个下标就行!
时间: 2024-10-10 20:56:21