jQuery   发布时间:2022-03-30  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了功能2 -- hover出现遮照效果大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

方法1(jquery):animate();

方法2(css):transition;

<!DOCTYPE html><html><head><Meta charset="utf-8" /><title></title>

<style type="text/css">
    * {
        margin: 0;
        padding: 0;
    }
    .father {
        overflow: hidden;
        position: relative;
        width: 200px;
        height: 200px;
        BACkground: #fff;
        border: 1px solid #000;
        margin: 0 auto;
    }
    .son {
        position: absolute;
        top: -100%;
        left: 0;
        width: 200px;
        height: 200px;
        BACkground: rgba(0,.5);
        color: #fff;
    }
</style>
<style type="text/css">
    .father1 {
        overflow: hidden;
        position: relative;
        width: 200px;
        height: 200px;
        BACkground: #fff;
        border: 1px solid #000;
        margin: 0 auto;
    }
    .son1 {
        position: absolute;
        top: -100%;
        left: 0;
        width: 200px;
        height: 200px;
        BACkground: rgba(0,.5);
        color: #fff;
        transition: top 1s;
    }
    .father1:hover .son1 {
        top: 0%;
    }
    
</style>
</head>

<body>
    <!-- jq方法 -->
    <div class="father">
        I am Father
        <div class="son">I am Son</div>
    </div>
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
    <script type="text/javascript">
        $(.father).mouSEOver(function () {
            $(this).find(.son).stop()
            $(this).find(.son).animate({top: 0%},slow)
        }).mouSEOut(function() {
            $(this).find(.son).stop()
            $(this).find(.son).animate({top: -100%},slow)
        })
    </script>
    <!-- css方法 -->
    <div class="father1">
        I am Father1
        <div class="son1">I am Son1</div>
    </div>
</html>
@H_986_618@

大佬总结

以上是大佬教程为你收集整理的功能2 -- hover出现遮照效果全部内容,希望文章能够帮你解决功能2 -- hover出现遮照效果所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。