$(function(){
var current=0;
var count=$(".pics-list>li").length;
// 播放轮播
function move(){
    $(".points-list>li").eq(current).addClass("active").siblings().removeClass("active");
    $(".pics-list").css("left",-1200 * current+"px");
}
// 下标,点击
$(".points-list>li").click(function(){
    current=$(this).index();
    move();
})
// 定时器
var timer=setInterval(()=>{
   next();
},3000);
// 移入
$(".banner-box").hover(function(){
   clearInterval(timer);
},function(){
   timer=setInterval(()=>{
    next();
 },3000);
})
// 定时器方法 next()
function next(){
    if(current<count-1){
        current++;
    }else{
        current=0
    }
    move();
}
// 左边按钮事件
$(".buts>.next").click(function(){
    if(current<count-1){
    current++;
    }else{
        current=0;

    }
    move();
})
// 右边按钮点击事件
$(".buts>.prev").click(function(){
    if(current>0){
    current--;
    }else{
        current=count-1;
    }
    move();
})


$(function(){
    $(".top-list .title").click(function(){
        $(this).addClass("active").siblings().removeClass("active");
        $(".top-list-main ul").eq($(this).index()).show().siblings().hide();
    })
})

})

 

 posted on 2021-11-15 17:08  陶小黑  阅读(40)  评论(0)    收藏  举报