2021.11.15项目

$(function(){
    $(".small_box").hover(function(){
        $(this).find(".float_layer").show();
        $(".big_box").show();
    },function(){
        $(this).find(".float_layer").hide();
        $(".big_box").hide();
    })
    $(".small_box").mousemove(function(e){
    //    鼠标位置
       var x = e.offsetX,y=e.offsetY;
       //小黑框的左上角位置
       var left = x-100; // -100     保证让鼠标永远在小黑框的中间
       var top = y-100;
       if(left<0) {
           left = 0;
       }
       if(top<0){
           top=0;
       }
       if(left>200){
           left=200;
       }
       if(top>200){
        top=200;
    }
       $(this).find(".float_layer").css({
           top:top+ "px",
           left: left + "px"
       })
       $(".big_box img").css({
           top: -2 * top+"px",
           left:-2*left+"px"
       })
    })
})
 
 
 
 
 
 
 
 
$(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");
    }
    function next(){
        if(current < count - 1){
            current++;
        }else{
            current = 0;
        }
        move();
    }

    setInterval(()=>{
        next();
    },3000);
    // 鼠标移入移出时  定时器显示  移入 起作用  移除  不起作用(不需要定时器)
    var timer=setInterval(()=>{
        next();
    },3000);


            $(".banner-box").hover(function(){
               //移入
             clearInterval(timer);
             },function(){
               //移除
              timer = setInterval(() => {
                next()
             }, 3000);
    })
   
    //    点击点的方法
    $(".points-list>li").click(function(){
        current=$(this).index();
        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();
    })
})
 
 
 
 
$(function(){
    $(".load-more").click(function(){
      
       
        // closest方法获得匹配选择器的第一个祖先元素,找父节点 如果不是  i一直找
        if($(this).hasClass("active")){

            $(this).removeClass("active").closest(".filter-list").css({"overflow":"hidden","height":"30px"});
        }else{
            $(this).addClass("active").closest(".filter-list").css({"overflow":"auto","height":"auto"});
        }
    })
})
posted on 2021-11-15 20:13  闲鱼仔  阅读(29)  评论(0)    收藏  举报