這裏顯示兩個版本的差異處。
Both sides previous revision 前次修改 下次修改 | 前次修改 | ||
playground:playground [2017/09/22 10:59] admin |
playground:playground [2018/05/03 06:39] (目前版本) |
||
---|---|---|---|
行 1: | 行 1: | ||
- | {{indexmenu>:# | + | ====== |
- | + | ||
- | <WRAP shadow tip> | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | < | + | |
- | #container { | + | |
- | width: 400px; | + | |
- | height: 400px; | + | |
- | position: relative; | + | |
- | background: yellow; | + | |
- | } | + | |
- | #animate { | + | |
- | width: 50px; | + | |
- | height: 50px; | + | |
- | position: absolute; | + | |
- | background-color: | + | |
- | } | + | |
- | </ | + | |
- | < | + | |
- | + | ||
- | <p> | + | |
- | <button onclick=" | + | |
- | </p> | + | |
- | + | ||
- | <div id =" | + | |
- | <div id =" | + | |
- | </ | + | |
- | + | ||
- | < | + | |
- | function myMove() { | + | |
- | var elem = document.getElementById(" | + | |
- | var pos = 0; | + | |
- | var id = setInterval(frame, | + | |
- | function frame() { | + | |
- | if (pos == 350) { | + | |
- | clearInterval(id); | + | |
- | } else { | + | |
- | pos++; | + | |
- | elem.style.top | + | |
- | elem.style.left | + | |
- | } | + | |
- | } | + | |
- | } | + | |
- | </ | + | |
- | + | ||
- | </ | + | |
- | </ | + | |