1. 程式人生 > >1.getelenmentbyid 2.換class類 css3動畫控制

1.getelenmentbyid 2.換class類 css3動畫控制

doctype height body sna pause anim over parent -c

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>

1.getelenmentbyid 2.換class類 css3動畫控制