-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweek7.js
80 lines (67 loc) · 1.76 KB
/
week7.js
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
function buttonchange (){
document.getElementById('buttonclick').text = "Do you always do as you're told?";
}
var aColor = document.getElementById('box');
aColor.addEventListener("mouseover", mouseOn);
aColor.addEventListener("mouseout", mouseOff);
function mouseOn(){
aColor.style.backgroundColor = 'silver';
}
function mouseOff(){
aColor.style.backgroundColor = 'lightgreen';
}
var key = document.getElementById('input');
key.addEventListener("keydown", keypress);
var box = document.getElementById('boxC');
function keypress (){
box.style.backgroundColor = 'lightgreen';
}
var touchD = document.getElementById('boxD');
touchD.addEventListener("touchstart", touchOn);
function touchOn(){
touchD.animate([
{ transform: 'translate(500px)' },
{ transform: 'translate(50px)' }
], {
duration: 10000,
});
}
var touchM = document.getElementById('boxG');
touchM.addEventListener("touchmove", touchMove);
function touchMove(){
touchM.animate([
{ transform: 'translate(50px)' },
{ transform: 'translate(500px)' }
], {
duration: 10000,
});
}
function loaded(){
var boxe = document.getElementById('boxE');
boxe.animate([
{ transform: 'rotate(0deg)' },
{ transform: 'rotate(360deg)' }
], {
duration: 10000,
iterations: Infinity
});
}
function changed(){
var boxf = document.getElementById('boxF');
var value = document.getElementById('drop').value;
if (value == "Hufflepuff"){
boxf.style.backgroundColor = '#ecb939';
}
else if (value == "Slytherin"){
boxf.style.backgroundColor = '#1a472a';
}
else if (value == "Ravenclaw"){
boxf.style.backgroundColor = '#0e1a40';
}
else {
boxf.style.backgroundColor = '#740001';
}
}
function reset (){
location.reload();
}