-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
131 lines (113 loc) · 3.7 KB
/
index.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
// Image Section
document.querySelector("img").style = "width: 18.75rem";
document.querySelector(".chill").addEventListener("click", function () {
var selectImageIdentity = this.getAttribute("src");
if (selectImageIdentity.indexOf("images/must-have.png") === -1) {
this.setAttribute("src", "images/must-have.png");
} else {
this.setAttribute(
"src",
"https://media.giphy.com/media/l1J9Jso7LPhtYWEKI/giphy.gif"
);
}
});
// Quote Section - Clicks
document.querySelector(".magic").addEventListener("click", function () {
var classSelect = document.querySelector(".quote-2").classList;
var checkInvisibility = classSelect.contains("invisibility");
switch (checkInvisibility) {
case true:
document.querySelector(".quote-2").classList.remove("invisibility");
document.querySelector(".quote-1").classList.add("invisibility");
break;
case false:
document.querySelector(".quote-2").classList.add("invisibility");
document.querySelector(".quote-1").classList.remove("invisibility");
default:
console.log(checkInvisibility);
break;
}
});
// Quote Section - Keypresses
document.addEventListener("keydown", function (event) {
switch (event.key) {
case "1":
document.querySelector(".quote-2").classList.remove("invisibility");
document.querySelector(".quote-1").classList.add("invisibility");
break;
case "2":
document.querySelector(".quote-2").classList.add("invisibility");
document.querySelector(".quote-1").classList.remove("invisibility");
default:
console.log(this.key);
break;
}
});
// Songs Section
var hereForYou = document.querySelector(".firehouse");
hereForYou.addEventListener("click", function () {
hereForYou.classList.add("clickeffects");
setTimeout(function () {
hereForYou.classList.remove("clickeffects");
}, 100);
});
var music = new Audio("Firehouse - Here for You (Official Video).weba");
var hereForYouPlay = document.querySelector(".firehouse");
hereForYouPlay.addEventListener("click", function () {
if (music.paused) {
music.play();
music2.pause();
music2.currentTime = 0;
music3.pause();
music3.currentTime = 0;
} else {
music.pause();
music.currentTime = 0;
}
});
var iWillNeverLetYouGo = document.querySelector(".steelheart");
iWillNeverLetYouGo.addEventListener("click", function () {
iWillNeverLetYouGo.classList.add("clickeffects");
setTimeout(function () {
iWillNeverLetYouGo.classList.remove("clickeffects");
}, 100);
});
var music2 = new Audio(
"Steelheart - I ll Never Let You Go (Official Video).mp3"
);
var iWillNeverLetYouGoPlay = document.querySelector(".steelheart");
iWillNeverLetYouGoPlay.addEventListener("click", function () {
if (music2.paused) {
music2.play();
music.pause();
music.currentTime = 0;
music3.pause();
music3.currentTime = 0;
} else {
music2.pause();
music2.currentTime = 0;
}
});
var missMisery = document.querySelector(".elliot-smith");
missMisery.addEventListener("click", function () {
missMisery.classList.add("clickeffects");
setTimeout(function () {
missMisery.classList.remove("clickeffects");
}, 100);
});
var music3 = new Audio(
"Miss Misery by Elliott Smith [Lyrics] Good Will Hunting (ending song).mp3"
);
var missMiseryPlay = document.querySelector(".elliot-smith");
missMiseryPlay.addEventListener("click", function () {
if (music3.paused) {
music3.play();
music2.pause();
music2.currentTime = 0;
music.pause();
music.currentTime = 0;
} else {
music3.pause();
music3.currentTime = 0;
}
});