-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
30 lines (26 loc) · 865 Bytes
/
script.js
File metadata and controls
30 lines (26 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var currentPos = 0;
var intervalHandle;
function beginAnimate() {
document.getElementById("join").style.position = "absolute";
document.getElementById("join").style.left = "0px";
document.getElementById("join").style.top = "100px";
// cause the animateBox function to be called
intervalHandle = setInterval(animateBox,50);
}
function animateBox() {
// set new position
currentPos+=5;
document.getElementById("join").style.left = currentPos + "px";
//
if ( currentPos > 900) {
// clear interval
clearInterval(intervalHandle);
// reset custom inline styles
document.getElementById("join").style.position = "";
document.getElementById("join").style.left = "";
document.getElementById("join").style.top = "";
}
}
window.onload = function() {
setTimeout(beginAnimate,5000);
};