-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
57 lines (51 loc) · 1.42 KB
/
script.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
const grid = document.getElementById("grid")
function checkMobileDevice() {
return "ontouchstart" in document.documentElement
}
if (checkMobileDevice()) {
document.body.classList.add("touch")
document.body.classList.remove("notouch")
} else {
document.body.classList.add("notouch")
document.body.classList.remove("touch")
}
const projects = [
"breakout-game",
"Custom Video Player",
"dom-array-methods",
"Exchange Rate Calculator",
"expense-tracker",
"form-validator",
"hangman",
"infinite-scroll-posts",
"lyrics-search",
"meal-finder",
"memory-cards",
"Menu Slider and Modal",
"Movie Seat Booking",
"music-player",
"new-year-countdown",
"relaxer-app",
"sortable-list",
"speak-number-guesser",
"speech-text-reader",
"typing-game",
]
projects.map((project) => {
const projectEl = `
<div class="thumbnail">
<img src="./img/${project}.PNG" alt="${project.toUpperCase()}"/>
<a href="${project}/"><div class="name">
<h3>${project.toUpperCase()}</h3>
</div></a>
</div>
`
grid.innerHTML += projectEl
})
const thumbnails = document.querySelectorAll(".thumbnail")
thumbnails.forEach((thumbnail) => {
thumbnail.addEventListener("click", () => {
//redirecting to anchor tag's href location
window.location = thumbnail.childNodes[3].href
})
})