-
Notifications
You must be signed in to change notification settings - Fork 0
/
part2.js
47 lines (38 loc) · 1.19 KB
/
part2.js
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
let slideIndex = 0;
function showSlide(n) {
const slides = document.querySelectorAll('.slide');
if (n >= slides.length) {
slideIndex = slides.length - 3;
}
if (n < 0) {
slideIndex = 0;
}
for (let i = 0; i < slides.length; i++) {
slides[i].style.display = 'none';
}
for (let i = slideIndex; i < slideIndex + 3; i++) {
slides[i].style.display = 'block';
}
}
function nextSlide() {
slideIndex += 3;
showSlide(slideIndex);
}
function prevSlide() {
slideIndex -= 3;
showSlide(slideIndex);
}
showSlide(slideIndex);
// Show preloader
document.addEventListener('DOMContentLoaded', function () {
const preloader = document.querySelector('.preloader');
setTimeout(function() {
preloader.classList.add('hide');
}, 2000); // 2000 milliseconds delay to show preloader
// Show content after preloader is hidden
setTimeout(function() {
preloader.style.display = 'none'; // Hide preloader
const content = document.querySelector('.content');
content.style.display = 'block'; // Show content
}, 4000); // 2000 milliseconds delay to hide preloader and additional 2000 milliseconds for content
});