1.对于border-color这样的样式,document.getElementById(‘demo‘).style.borderColor=‘red‘;带横线的连起来去掉横线,从第二个字母开始大写。
2.换class类的操作,主要对于整体样式的应用,比如网页的换肤功能。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
#ddd img{
width: 196px;
height: 196px;
border: 1px solid transparent;
border-radius: 50%;
}
@keyframes myfirst{
from{transform: rotate(0deg);}
to{transform: rotate(360deg);}
}
#ddd{
animation: myfirst 3s linear infinite running;
width: 200px;
height: 200px;
margin: 0 auto;
border: 1px solid red;
border-radius: 50%;
}
.stop{
animation: myfirst 3s linear infinite paused;
width: 200px;
height: 200px;
margin: 0 auto;
border: 1px solid red;
border-radius: 50%;
}
.running{
animation: myfirst 3s linear infinite running;
width: 200px;
height: 200px;
margin: 0 auto;
border: 1px solid red;
border-radius: 50%;
}
</style>
</head>
<body>
<div id="ddd" onmouseover="document.getElementById(‘ddd‘).style.animationPlayState=‘paused‘";
onmouseout="document.getElementById(‘ddd‘).style.animationPlayState=‘running‘";>
<img src="img/01.jpg">
</div>
<div id="ddd" onmouseover="this.className=‘stop‘";
onmouseout="this.className=‘running‘">
<img src="img/01.jpg">
</div>
</body>
</html>