-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgrid.js
34 lines (25 loc) · 839 Bytes
/
grid.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
let gridContainer = document.createElement("div");
gridContainer.classList.add('gridContainer')
let frag = document.createDocumentFragment();
for (let i = 0; i < games.length; i++) {
//const link = document.createElement("a")
//link.href=`${games[i].link}`
const test = document.createElement('div');
test.classList.add('gridElement')
test.addEventListener("click", function () {
goPage(i)
});
test.addev
test.innerHTML = `
<img src='images${games[i].media.path + games[i].media.thumbnail}' alt="tenten"/>
<span>${games[i].title}</span>
`
frag.appendChild(test)
}
let body = document.body.querySelector('.content');
const goPage = (index) => {
sessionStorage.setItem("portFolioIndex", index);
location.href = 'portfolioItem.html'
}
gridContainer.appendChild(frag)
body.appendChild(gridContainer);