首页 > 代码库 > 1.getelenmentbyid 2.换class类 css3动画控制
1.getelenmentbyid 2.换class类 css3动画控制
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" onm ouseover="document.getElementById(‘ddd‘).style.animationPlayState=‘paused‘";
onm ouseout="document.getElementById(‘ddd‘).style.animationPlayState=‘running‘";>
<img src="http://www.mamicode.com/img/01.jpg">
</div>
<div id="ddd" onm ouseover="this.className=‘stop‘";
onm ouseout="this.className=‘running‘">
<img src="http://www.mamicode.com/img/01.jpg">
</div>
</body>
</html>
1.getelenmentbyid 2.换class类 css3动画控制