這裏顯示兩個版本的差異處。
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=" | ||
- | </ | ||
- | |||
- | <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 = pos + ' | ||
- | elem.style.left = pos + ' | ||
- | } | ||
- | } | ||
- | } | ||
- | </ | ||
- | |||
- | </ | ||
- | </ | ||
- | |||