-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
92 lines (80 loc) · 2.3 KB
/
index.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
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
// * Slider jQuery
$(document).ready(function () {
// Auto Slider
let slideInterval;
function startSlideInterval() {
slideInterval = setInterval(function () {
let currentSlide = $(".active");
let nextSlide = currentSlide.next();
// if ((nextSlide.length = 7))
if (nextSlide.length) {
currentSlide.removeClass("active");
nextSlide.addClass("active");
}
if (nextSlide.length == 0) {
let slides = $(".slider");
nextSlide = slides.first();
currentSlide.removeClass("active");
nextSlide.addClass("active");
}
}, 5000);
}
function stopSlideInterval() {
clearInterval(slideInterval);
}
// startSlideInterval();
// Next Slider
$(".slider_next_arrow").on("click", function () {
stopSlideInterval();
let currentSlide = $(".active");
let nextSlide = currentSlide.next();
// if ((nextSlide.length = 7))
if (nextSlide.length) {
currentSlide.removeClass("active");
nextSlide.addClass("active");
}
if (nextSlide.length == 0) {
let slides = $(".slider");
nextSlide = slides.first();
currentSlide.removeClass("active");
nextSlide.addClass("active");
}
startSlideInterval();
});
// Prev Slider
$(".slider_prev_arrow").on("click", function () {
stopSlideInterval();
let currentSlide = $(".active");
let prevSlide = currentSlide.prev();
console.log(prevSlide.length);
if (prevSlide.length) {
currentSlide.removeClass("active");
prevSlide.addClass("active");
}
if (prevSlide.length == 0) {
let slides = $(".slider");
prevSlide = slides.last();
prevSlide.addClass("active");
currentSlide.removeClass("active");
}
startSlideInterval();
});
startSlideInterval();
});
// Scroll Animation
document.addEventListener("DOMContentLoaded", function () {
const observer = new IntersectionObserver((entries) => {
console.log("yes");
entries.forEach((entry) => {
console.log(entry);
if (entry.isIntersecting) {
entry.target.classList.add("show");
}
// else {
// entry.target.classList.remove("show");
// }
});
});
const hiddenElements = document.querySelectorAll(".hidden");
hiddenElements.forEach((el) => observer.observe(el));
});