偶尔需要用到div闪烁的动态效果,以下是一个简单的例子。写的不好,请见谅。
css如下:我是从黄色变成橙色的动态效果,你可以自己修改颜色
.highlight {
animation: myfirst 5s;
animation-iteration-count: infinite;
}
@keyframes myfirst {
0% {
background: orange;
}
25% {
background: yellow;
}
50% {
background: orange;
}
100% {
background: yellow;
}
}
html使用如下
<div>
<p>test page</p>
<img src="~/Content/map.png" />
<div style="background-color:yellow;height:12px;width:12px;top:200px;left:200px;position:fixed;z-index:100;" title="M1" class="stopPoint highlight"> </div>
<div style="background-color:yellow;height:12px;width:12px;top:300px;left:200px;position:fixed;z-index:100;" title="M2" class="stopPoint highlight"> </div>
<div style="background-color:yellow;height:12px;width:12px;top:400px;left:200px;position:fixed;z-index:100;" title="M3" class="stopPoint"> </div>
<div style="background-color:yellow;height:12px;width:12px;top:500px;left:200px;position:fixed;z-index:100;" title="M4" class="stopPoint"> </div>
</div>
然后使用jquery 增加或者 css 即可。