该知道的都知道了,不知道的代码里都有
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>定时器实现动画效果(纯js实现)</title>
<style>
* {
margin: 0;
padding: 0;
}
#bbox {
margin-top: 100px;
}
#box {
margin-top: 10px;
width: 100px;
height: 100px;
background-color: lightblue;
position: absolute;
padding: 0;
}
</style>
</head>
<body>
<div id="bbox">
<button id="begin">开始</button>
<button id="stop">暂停</