jQuery实现王者荣耀手风琴效果

大佬轻点我怕疼

效果图如下,当当…^~*OK

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        li {
     
            list-style: none;
            float: left;
        }
        .box1 {
     
            display: none;
            width: 224px;
            height: 69px;
            right: 10px;
        }
        ul {
     
            position: relative; 
            height: 68px;
            overflow: hidden;   
        }
        .box {
     
            
            width: 69px;
            height: 68px;
            
        }
        
    </style>
    <script src="jquery.min.js"></script>
</head>
<body>
    <div class="king">
        <ul>
            <li class="current"><a href=""><img src="图片/107-freehover.png" alt="" class="box1" style="display: block;"><img src="图片/107-freehover - 副本.png" alt="" class="box" style="display: none;"></a></li>
            <li><a href=""><img src="图片/134-freehover.png" alt="" class="box1"><img src="图片/134-freehover - 副本.png" alt="" class="box"></a></li>
            <li><a href=""><img src="图片/141-freehover.png" alt="" class="box1"><img src="图片/141-freehover - 副本.jpg" alt="" class="box"></a></li>
            <li><a href=""><img src="图片/144-freehover.png" alt="" class="box1"><img src="图片/144-freehover - 副本.jpg" alt="" class="box"></a></li>
            <li><a href=""><img src="图片/148-freehover.png" alt="" class="box1"><img src="图片/148-freehover - 副本.jpg" alt="" class="box"></a></li>
            <li><a href=""><img src="图片/171-freehover.png" alt="" class="box1"><img src="图片/171-freehover - 副本.jpg" alt="" class="box"></a></li>
            <li><a href=""><img src="图片/177-freehover.png" alt="" class="box1"><img src="图片/177-freehover - 副本.png" alt="" class="box"></a></li>
        </ul>
    </div>
    <script>
        $(function() {
     
            $('.king li').mouseenter(function() {
     
                $(this).stop().animate({
     
                width: 224
                }).find('.box').stop().fadeOut().siblings('.box1').stop().fadeIn();
                $(this).siblings('li').stop().animate({
     
                    width: 69
                }).find('.box').stop().fadeIn().siblings('.box1').stop().fadeOut();
            })
        })
    </script>
</body>
</html>

你可能感兴趣的:(javascript)