-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJavaScript.js
More file actions
24 lines (21 loc) · 831 Bytes
/
Copy pathJavaScript.js
File metadata and controls
24 lines (21 loc) · 831 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
let preveiwContainer = document.querySelector('.products-preview');
let preveiwBox = preveiwContainer.querySelectorAll('.preview');
document.querySelectorAll('.Product-container .product').forEach(product => {
product.onclick = () => {
preveiwContainer.style.display = 'flex';
let name = product.getAttribute('data.name');
preveiwBox.forEach(preview => {
preview.getAttribute('data-target');
let target = preview.getAttribute('data-target');
if (name == target) {
preview.classList.add('active');
}
});
};
});
preveiwBox.forEach(close => {
close.querySelector('.fa-times').onclick = () => {
close.classList.remove('active');
preveiwContainer.style.display = 'none';
};
});