微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

javascript – 当您悬停时,如何使虚线边框线顺时针移动[复制]

参见英文答案 > Dashed border animation in css3 animation                                    5个
我在div元素周围有一个虚线边框:

.dash_border{
        border: dashed;
        stroke: 2px;
        margin:20px;
    }

当我的指针位于div元素的顶部时,我想顺时针移动虚线,当我离开该元素时,我想停止.我该怎么做 ?

解决方法

div {
    background: white;
    border: 2px solid black;
    width: 200px;
    height: 200px;
    border-radius: 50%;
}

div:hover {
     -webkit-animation: rotate 2s linear infinite;
     border: 2px dashed blue;
}

@-webkit-keyframes rotate {
    from{
        -webkit-transform: rotate(0deg);
    }
    to{
        -webkit-transform: rotate(180deg);
    }
}
<div class="rotate"></div>

这是基于这个答案:Making a circle with dotted border in css and animating on hover.

http://jsfiddle.net/MadalinaTn/j4ys9x2L/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐