<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<style type="text/css" media="screen">
* {
margin: 0;
padding: 0;
}
#wrap {
position: relative;
margin: 20px auto;
width: 1000px;
height: 600px;
background-color: #666666;
}
#wrap .hot {
position: absolute;
width: 30px;
height: 30px;
}
#hot-1 {
top: 123px;
left: 566px;
}
#hot-2 {
top: 56px;
left: 236px;
}
#hot-3 {
top: 456px;
left: 789px;
}
.hot .a-hot ,.hot .a-hot .hot-icon {
display: inline-block;
width: 100%;
height: 100%;
}
.hot .a-hot .hot-icon {
border-radius: 50%;
background-color: red;
-webkit-animation: hot-animate 1s infinite;
animation: hot-animate 1s infinite;
}
.hot .a-hot .hot-img {
display: none;
position: absolute;
width: 100px;
height: 100px;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%,-50%);
transform: translate(-50%,-50%);
}
#hot-img1 {
background-color: yellow;
}#hot-img2 {
background-color: blue;
}
#hot-img3 {
background-color: green;
}
@keyframes hot-animate {
0% {
-webkit-transform: scale(0.1);
-ms-transform: scale(0.1);
-o-transform: scale(0.1);
transform: scale(0.1);
}
25% {
-webkit-transform: scale(0.6);
-ms-transform: scale(0.6);
-o-transform: scale(0.6);
transform: scale(0.6);
}
50% {
-webkit-transform: scale(0.9);
-ms-transform: scale(0.9);
-o-transform: scale(0.9);
transform: scale(0.9);
}
75% {
-webkit-transform: scale(0.6);
-ms-transform: scale(0.6);
-o-transform: scale(0.6);
transform: scale(0.6);
}
100% {
-webkit-transform: scale(0.1);
-ms-transform: scale(0.1);
-o-transform: scale(0.1);
transform: scale(0.1);
}
}
@-webkit-keyframes hot-animate {
0% {
-webkit-transform: scale(0.1);
-ms-transform: scale(0.1);
-o-transform: scale(0.1);
transform: scale(0.1);
}
25% {
-webkit-transform: scale(0.6);
-ms-transform: scale(0.6);
-o-transform: scale(0.6);
transform: scale(0.6);
}
50% {
-webkit-transform: scale(0.9);
-ms-transform: scale(0.9);
-o-transform: scale(0.9);
transform: scale(0.9);
}
75% {
-webkit-transform: scale(0.6);
-ms-transform: scale(0.6);
-o-transform: scale(0.6);
transform: scale(0.6);
}
100% {
-webkit-transform: scale(0.1);
-ms-transform: scale(0.1);
-o-transform: scale(0.1);
transform: scale(0.1);
}
}
</style>
</head>
<body>
鼠标移入的时候,会触发两次mouseover,一次mouseout,而且页面加载完首次移入时,图片会闪亮一下,接着才正常
<div id="wrap">
<div id="hot-1">
<a href="">
<span></span>
<div id="hot-img1"></div>
</a>
</div>
<div id="hot-2">
<a href="http://www.baidu.com">
<span></span>
<div id="hot-img2"></div>
</a>
</div>
<div id="hot-3">
<a href="">
<span></span>
<div id="hot-img3"></div>
</a>
</div>
</div>
<script type="text/javascript" src="script.js"></script>
</body>
</html>