两个边框交互小效果

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<style>
    dl,dd,dt,div,span{
        margin: 0;
        padding: 0;
    }
    .watchLogo{
        width: 200px;
        margin: 0 auto;

    }
    .watchLogo dl {

        width: 180px;
        height: 90px;
        border: 1px solid #f3f3f3;
        position: relative;
        margin: 0px 21.3px 0px 0px;
    }
    .watchLogo dl dd.hover {
        display: table;
    }
    .watchLogo dl dd {
        width: 180px;
        height: 90px;
        text-align: center;
        position: absolute;
        left: 0;
        top: 0;
        background: #fff;
        display: none;
    }
    .watchLogo dl dd div {
        display: table-cell;
        vertical-align: middle;
    }
    .watchLogo dl dd div span.span_l {
        background: url(http://i1.piimg.com/1949/71b60a9febc098ad.png) no-repeat left top;
        width: 0;
        height: 0;
        position: absolute;
        left: -1px;
        top: -1px;
        overflow: hidden;
    }
    .watchLogo dl dd div span.span_r {
        background: url(http://i1.piimg.com/1949/7c2801db55909f8b.png) right bottom;
        width: 0;
        height: 0;
        position: absolute;
        right: -1px;
        bottom: -1px;
        overflow: hidden;
    }
    .w2{
        width: 180px;
        height: 90px;
        position: relative;
        background: none;
        margin-top: 30px;
        box-sizing: border-box;
        box-shadow: inset 0 0 0 0 transparent;
        -webkit-transition: all 0.6s ease-in;
        -moz-transition: all 0.6s ease-in;
        -ms-transition: all 0.6s ease-in;
        -o-transition: all 0.6s ease-in;
        transition: all 0.6s ease-in;

    }
    .w2:after, .w2:before {
        box-sizing: border-box;
        border: 1px solid transparent;
        width: 0;
        height: 0;
    }
    .w2:before {
        bottom: 0;
        right: 0;
        -webkit-transition: border-color 0s ease-in 0.4s,width 0.2s ease-in 0.2s,height 0.2s ease-in;
        transition: border-color 0s ease-in 0.4s,width 0.2s ease-in 0.2s,height 0.2s ease-in;

    }

    .w2:after{
        top: 0;
        left: 0;
        -webkit-transition: border-color 0s ease-in 0.8s,width 0.2s ease-in 0.6s,height 0.2s ease-in 0.4s;
        transition: border-color 0s ease-in 0.8s,width 0.2s ease-in 0.6s,height 0.2s ease-in 0.4s;
    }

    .w2:before {
        content: '';
        display: block;
        position: absolute;
    }
    .w2:after {
        content: '';
        display: block;
        position: absolute;

    }
    .w2:hover{
        /*border: 1px solid #367dff;*/
    }
    .w2:hover:after, .w2:hover:before {
        width: 100%;
        height: 100%;
    }
    .w2:hover:before {
        border-bottom-color: #367dff;
        border-left-color: #367dff;
        -webkit-transition: border-color 0s ease-out 0.4s,width 0.2s ease-out 0.4s,height 0.2s ease-out 0.6s;
        transition: border-color 0s ease-out 0.4s,width 0.2s ease-out 0.4s,height 0.2s ease-out 0.6s;
    }
    .w2:hover:after {
        border-top-color: #367dff;
        border-right-color: #367dff;
        -webkit-transition: width 0.2s ease-out,height 0.2s ease-out 0.2s;
        transition: width 0.2s ease-out,height 0.2s ease-out 0.2s;
    }

</style>

<body>

   <div class="watchLogo">
        <dl>
            <dt>
                <img src="http://oh4n64elp.bkt.clouddn.com/kind//e98c5d39428449d7aada303686f48797"  width="180" height="90" alt="" />
            </dt>
            <dd>
                <div>
                    <span class="wz">百达翡丽</span>
                    <span class="span_l"></span>
                    <span class="span_r"></span>
                </div>
            </dd>
        </dl>
       <div class="w2">
           <img src="http://oh4n64elp.bkt.clouddn.com/kind//e98c5d39428449d7aada303686f48797"  width="180" height="90" alt="" />
       </div>
   </div>



</body>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script>

    $(".watchLogo dl").hover(function(){
        $(this).children("dd").addClass("hover");
        $(this).children("dd").find(".span_l").animate({"height": "92px", "width": "182px"}, 300);
        $(this).children("dd").find(".span_r").animate({"height": "92px", "width": "182px"}, 300);
    },function(){
        $(this).children("dd").removeClass("hover");
        $(this).children("dd").find(".span_l").animate({"height":"0","width":"0px"},0);
        $(this).children("dd").find(".span_r").animate({"height":"0","width":"0px"},0);
    })
</script>
</html>

欢迎分享本文,转载请保留出处:前端ABC » 两个边框交互小效果

赞 (0)
分享到:更多 ()

发表评论 0