jq高亮效果

在这里插入图片描述

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="jquery.min.js"></script>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            list-style: none;
        }
        
        body {
            background-color: black;
        }
        
        .content {
            width: 650px;
            height: 420px;
            margin: 100px auto;
            border: 1px solid #fff;
        }
        
        .imgbox {
            width: 650px;
            height: 420px;
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            align-content: space-around;
            justify-items: center;
        }
        
        .over {
            background-color: black;
            opacity: .5;
        }
    </style>
</head>

<body>
    <div class="content">
        <ul class="imgbox">
            <li><img src="images/01.jpg" alt=""> </li>
            <li><img src="images/02.jpg" alt=""> </li>
            <li><img src="images/03.jpg" alt=""> </li>
            <li><img src="images/04.jpg" alt=""> </li>
            <li><img src="images/05.jpg" alt=""> </li>
            <li><img src="images/06.jpg" alt=""> </li>
        </ul>
    </div>
    <script>
        // var box = document.querySelector('.imgbox');
        // for (var i = 0; i < box.children.length; i++) {
        //     box.children[i].addEventListener('mouseover', function(e) {
        //         for (var i = 0; i < box.children.length; i++) {
        //             box.children[i].className = 'over';
        //         }
        //         this.setAttribute('class', '');

        //     })

        // }
        $(function() {
            $(".imgbox li").hover(function() {
                $(this).siblings('li').stop().fadeTo(200, 0.5)

            }, function() {
                $(this).siblings('li').stop().fadeTo(200, 1)
            })
        })
    </script>

</body>

</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值