-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
78 lines (71 loc) · 2.82 KB
/
Copy pathscript.js
File metadata and controls
78 lines (71 loc) · 2.82 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
document.addEventListener('DOMContentLoaded', function() {
let next = document.querySelector('.next');
let prev = document.querySelector('.prev');
let modal = document.getElementById('modal');
let albumContainer = document.getElementById('album-container');
let closeModal = document.querySelector('.close');
// Wait for all assets to be loaded
window.addEventListener('load', function() {
// Hide the loading screen after everything is loaded
const loadingScreen = document.getElementById('loading-screen');
loadingScreen.style.opacity = '0';
setTimeout(() => {
loadingScreen.style.display = 'none';
}, 10000); // Match the transition duration in CSS
});
// Initialize Swiper
let swiper = new Swiper('.swiper-container', {
effect: 'coverflow',
grabCursor: true,
centeredSlides: true,
slidesPerView: 'auto',
coverflowEffect: {
rotate: 50,
stretch: 0,
depth: 100,
modifier: 1,
slideShadows: true,
},
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
pagination: {
el: '.swiper-pagination',
clickable: true,
},
});
// Next button functionality
next.addEventListener('click', function() {
let items = document.querySelectorAll('.item');
document.querySelector('.slide').appendChild(items[0]);
});
// Previous button functionality
prev.addEventListener('click', function() {
let items = document.querySelectorAll('.item');
document.querySelector('.slide').prepend(items[items.length - 1]);
});
const seeMoreBtns = document.querySelectorAll('.see-more');
seeMoreBtns.forEach(btn => {
btn.addEventListener('click', (e) => {
let albumImages = JSON.parse(e.target.getAttribute('data-images')); // جلب الصور من data attribute
albumContainer.innerHTML = ''; // تفريغ الحاوية
albumImages.forEach(imgSrc => {
let img = document.createElement('img');
img.src = imgSrc;
albumContainer.appendChild(img);
});
modal.style.display = 'block'; // إظهار النافذة المنبثقة
});
});
// إغلاق النافذة
closeModal.addEventListener('click', () => {
modal.style.display = 'none';
});
// إغلاق النافذة عند النقر خارج الصور
window.addEventListener('click', (e) => {
if (e.target === modal) {
modal.style.display = 'none';
}
});
});