鼠标经过显示 动画

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

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./animate.js"></script>
    <style>
        .sliberbar {
            position: fixed;
            right: 0;
            bottom: 100px;
             40px;
            height: 40px;
            text-align: center;
            line-height: 40px;
            cursor: pointer;
            color: #fff;
        }
        
        .con {
            position: absolute;
            left: 0;
            top: 0;
             200px;
            height: 40px;
            background-color: purple;
            z-index: -1;
        }
    </style>
</head>


<body>
    <div class="sliberbar">
        <span>←</span>
        <div class="con">问题反馈</div>
    </div>

    <script>
        var sliderbar = document.querySelector('.sliberbar');
        var con = document.querySelector('.con');
        sliderbar.addEventListener('mouseenter', function() {
            animate(con, -160, function() {
                sliderbar.children[0].innerHTML = '→';
            });
        })
        sliderbar.addEventListener('mouseleave', function() {
            animate(con, 0, function() {
                sliderbar.children[0].innerHTML = '←';
            });
        })
    </script>
</body>

</html>
原文地址:https://www.cnblogs.com/ericblog1992/p/13061556.html