<分区>
我在 div 元素周围加了虚线边框:
.dash_border{
border: dashed;
stroke: 2px;
margin:20px;
}
我想在我的指针位于 div 元素顶部时顺时针移动虚线,并在我离开该元素时停止。我该怎么做?
标签 javascript jquery html css
<分区>
我在 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 .
关于javascript - 悬停时如何使虚线边框顺时针移动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40057495/