-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeaturedScript.js
More file actions
71 lines (64 loc) · 2.19 KB
/
Copy pathfeaturedScript.js
File metadata and controls
71 lines (64 loc) · 2.19 KB
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
window.initFeaturedPage = function () {
const data = [
{
title: "Haptic Brick",
image: "./assets/brick.jpg",
text: "'Demolish the Lego Castle.' Haptic Brick was made to demonstrate iOS app Brrrowser's enhanced vibration features.",
url: "https://haptic-brick.vercel.app"
},
{
title: "Haptic Music",
image: "./assets/hapmusic.jpg",
text: "'Haptic Music' is originally a Poimandres demo code. In this version, haptic feedbacks have been implemented and are in sync with the music, played according to each track's gain as intensity.",
url: "https://hapticmusic.vercel.app/"
},
{
title: "Stack over",
image: "./assets/stackover.jpg",
text: "'Stack Over' is a webgame in which the aim is to stack blocks as high as one can. Game made using R3F and Rapier's physics. ",
url: "https://tower-stacker.vercel.app"
},
{
title: "Strolling Snowman",
image: "./assets/stroll.jpg",
text: "'Strolling Snowman' is a 3D Winter puzzle. Step on powdered snow to reach the height necessary to collect all gems and clear levels.",
url: "https://strolling-snowman.vercel.app"
}
];
const grid = document.getElementById("cardGrid");
if (!grid) return;
data.forEach((item) => {
const card = document.createElement("div");
card.className = "card";
card.innerHTML = `
<div class="card-inner">
<div class="card-front">
<img src="${item.image}" alt="${item.title}" />
</div>
</div>
<h3>${item.title}</h3>
`;
card.addEventListener("click", () => showModal(item));
grid.appendChild(card);
});
};
function showModal(item) {
const modal = document.createElement("div");
modal.className = "modal-overlay";
modal.innerHTML = `
<div class="modal-card">
<div class="modal-header">
<h3>${item.title}</h3>
<img src="${item.image}" alt="${item.title}" />
</div>
<p>${item.text}</p>
<button onclick="window.open('${item.url}', '_self')">GO</button>
</div>
`;
document.body.appendChild(modal);
modal.addEventListener("click", (e) => {
if (e.target === modal || e.target.classList.contains("close-btn")) {
modal.remove();
}
});
}