感谢您的支持,我会继续努力的!
打开微信扫一扫,即可进行扫码打赏哦
点我查看本站打赏源码!
Powered by RUNCODEX.COM,学的不仅是技术,更是梦想!!!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runcodex.com)</title>
<style>
#myDIV{
width:100px;
height:100px;
background:red;
position:relative;
animation:mymove 1s infinite;
-webkit-animation:mymove 1s infinite; /*Safari 和 Chrome*/
}
@keyframes mymove{
from {left:0px;}
to {left:200px;}
@-webkit-keyframes mymove { /*Safari 和 Chrome*/
@keyframes mynewmove{
from {top:0px;}
to {top:200px;}
@-webkit-keyframes mynewmove{ /*Safari 和 Chrome*/
</style>
</head>
<body>
<p>点击“尝试一下”按钮改变 animation 属性的值。</p>
<button onclick="myFunction()">尝试一下</button>
<script>
function myFunction(){
document.getElementById("myDIV").style.animation = "mynewmove 4s 2";
document.getElementById("myDIV").style.WebkitAnimation = "mynewmove 4s 2"; // 针对 Chrome 和 Safari 的代码
</script>
<p><strong>注意:</strong>Internet Explorer 9 及其之前的版本不支持 animation 属性。</p>
<div id="myDIV"></div>
</body>
</html>
输入 JavaScript 代码……
xxxxxxxxxx
输入 CSS 代码……