-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
157 lines (135 loc) · 5.36 KB
/
Copy pathscript.js
File metadata and controls
157 lines (135 loc) · 5.36 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
const hamburger = document.querySelector('.hamburger');
const navMenu = document.querySelector('.nav-menu');
const tap = document.querySelector('.tap');
hamburger.addEventListener('click', () => {
hamburger.classList.toggle('active');
navMenu.classList.toggle('active');
});
document.querySelectorAll('.nav-item').forEach((e) => e.addEventListener('click', () => {
hamburger.classList.remove('active');
navMenu.classList.remove('active');
tap.classList.remove('active');
}));
window.onclick = function global(event) {
if (event.target === tap) {
tap.style.display = 'none';
window.location.reload();
}
};
// ######## Array of objects for project card pop-up data ########
const modalContent = [
{
modalImg: 'imege/awsome-book.png',
modalName: 'Awesome-Books',
alt: 'project img',
technologies: ['Html', 'Css', 'Js-ES6'],
description:
'A basic website that allows users to add/remove books from a list. I achieved that by using JavaScript objects and arrays.',
links: [
'https://muhmmdusama.github.io/Awesome-Books/#',
'https://github.com/MuhmmdUsama/Awesome-Books-ES6',
],
},
{
modalImg: 'imege/Snapshoot-Portfolio.svg',
modalName: 'Keeping track of hundreds of components',
alt: 'project img',
technologies: ['Ruby', 'Css', 'javaScript'],
description:
'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industryLorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry',
links: [
'https://github.com/MuhmmdUsama',
'https://github.com/MuhmmdUsama/Portfolio',
],
},
{
modalImg: 'imege/Snapshoot-Portfolio.svg',
modalName: 'Keeping track of hundreds of components',
alt: 'project img',
technologies: ['Ruby', 'Css', 'javaScript'],
description:
'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industryLorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry',
links: [
'https://github.com/MuhmmdUsama',
'https://github.com/MuhmmdUsama/Portfolio',
],
},
{
modalImg: 'imege/Snapshoot-Portfolio.svg',
modalName: 'Keeping track of hundreds of components',
alt: 'project img',
technologies: ['Ruby', 'Css', 'javaScript'],
description:
'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industryLorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry',
links: [
'https://github.com/MuhmmdUsama',
'https://github.com/MuhmmdUsama/Portfolio',
],
},
{
modalImg: 'imege/Snapshoot-Portfolio.svg',
modalName: 'Keeping track of hundreds of components',
alt: 'project img',
technologies: ['Ruby', 'Css', 'javaScript'],
description:
'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industryLorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry',
links: [
'https://github.com/MuhmmdUsama',
'https://github.com/MuhmmdUsama/Portfolio',
],
},
{
modalImg: 'imege/Snapshoot-Portfolio.svg',
modalName: 'Keeping track of hundreds of components',
alt: 'project img',
technologies: ['Ruby', 'Css', 'javaScript'],
description:
'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industryLorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry',
links: [
'https://github.com/MuhmmdUsama',
'https://github.com/MuhmmdUsama/Portfolio',
],
},
];
// ################# Create HTML modal temblet
function openModal(ind) {
const section = document.querySelector('.Proj-container');
const overlay = document.querySelector('.overlay');
const modalHtml = `
<div class='modal'>
<button type='button' class='modal__exit'>
×
</button>
<img src='${modalContent[ind].modalImg}' alt='${modalContent[ind].alt}' class='modal__img'>
<h3 class='modal__name'>${modalContent[ind].modalName}</h3>
<ul class='card__list modal__tech'>
<li>${modalContent[ind].technologies[0]}</li>
<li>${modalContent[ind].technologies[1]}</li>
<li>${modalContent[ind].technologies[2]}</li>
</ul>
<p class='modal__description'>
${modalContent[ind].description}
</p>
<div class='modal__buttons'>
<a href='${modalContent[ind].links[0]}' class='btn btn--green'>See Live <img src='imege/see-live.svg' alt=''></a>
<a href='${modalContent[ind].links[1]}' class='btn btn--green'>Source <img src='imege/see-source.svg' alt=''></a>
</div>
</div>
`;
section.insertAdjacentHTML('afterbegin', modalHtml);
overlay.classList.remove('hidden');
const closeModalIcon = document.querySelector('.modal__exit');
const modal = document.querySelector('.modal');
// When the user clicks on (x), close the modal
closeModalIcon.addEventListener('click', () => {
modal.style.display = 'none';
overlay.classList.add('hidden');
});
}
document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('.Proj-container .See-Project').forEach((btn, ind) => {
btn.addEventListener('click', () => {
openModal(ind);
});
});
});