-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgames.js
35 lines (27 loc) · 1003 Bytes
/
games.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
// games.js
const games = [
{
title: "Math Practice 1",
url: "math_practice_1/index.html"
}
];
document.addEventListener('DOMContentLoaded', () => {
const gameGrid = document.getElementById('gameGrid');
games.forEach(game => {
const gameCard = document.createElement('div');
gameCard.classList.add('game-card');
const title = document.createElement('h3');
title.textContent = game.title;
gameCard.appendChild(title);
const thumbnail = document.createElement('img');
thumbnail.src = `${game.url.replace('index.html', '')}thumbnail.png`;
thumbnail.alt = `${game.title} Thumbnail`;
gameCard.appendChild(thumbnail);
const playButton = document.createElement('a');
playButton.href = game.url;
playButton.classList.add('play-button');
playButton.textContent = 'Play Now';
gameCard.appendChild(playButton);
gameGrid.appendChild(gameCard);
});
});