-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
84 lines (77 loc) · 2.29 KB
/
script.js
File metadata and controls
84 lines (77 loc) · 2.29 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
72
73
74
75
76
77
78
79
80
81
82
83
84
// Mobile MenuPopup
const menuIcon = document.querySelector('.humburger');
const navbar = document.querySelector('.navbar');
menuIcon.addEventListener('click', () => {
menuIcon.classList.toggle('change');
navbar.classList.toggle('change');
});
// Projects
const projects = [
{
title: 'deep earth',
mobileImage: './images/mobile/image-deep-earth.jpg',
featuredImage: './images/desktop/image-deep-earth.jpg',
},
{
title: 'night arcade',
mobileImage: './images/mobile/image-night-arcade.jpg',
featuredImage: './images/desktop/image-night-arcade.jpg',
},
{
title: 'soccer team vr',
mobileImage: './images/mobile/image-soccer-team.jpg',
featuredImage: './images/desktop/image-soccer-team.jpg',
},
{
title: 'the grid',
mobileImage: './images/mobile/image-grid.jpg',
featuredImage: './images/desktop/image-grid.jpg',
},
{
title: 'from up above vr',
mobileImage: './images/mobile/image-from-above.jpg',
featuredImage: './images/desktop/image-from-above.jpg',
},
{
title: 'pocket borealis',
mobileImage: './images/mobile/image-pocket-borealis.jpg',
featuredImage: './images/desktop/image-pocket-borealis.jpg',
},
{
title: 'the curiosity',
mobileImage: './images/mobile/image-curiosity.jpg',
featuredImage: './images/desktop/image-curiosity.jpg',
},
{
title: 'make it fisheye',
mobileImage: './images/mobile/image-fisheye.jpg',
featuredImage: './images/desktop/image-fisheye.jpg',
},
];
// Dynamically render projects
function renderCards(work) {
return `
<div class="card-m card-d">
<div class="card-overlay">
<img class="card-img" src="${work.mobileImage}" alt="Project 1" aria-hidden="true" />
</div>
<div class="card-content">
<img class="card-img-desktop" src="${work.featuredImage}" alt="Project 1" aria-hidden="true" />
</div>
<div class="card-content">
<h2 class="title color-caption">${work.title}</h2>
</div>
</div>
`;
}
const projectsContainer = document.querySelector('#projects-container');
projectsContainer.innerHTML = `
${projects.map(renderCards).join('')}
`;
// Containing Array
const allCardNames = [];
// Looping through the array
for (let i = 0; i < projects.length; i += 1) {
allCardNames.push(projects[i].title);
}
//