-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.js
More file actions
64 lines (50 loc) · 1.22 KB
/
Copy pathmain.js
File metadata and controls
64 lines (50 loc) · 1.22 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
var quotes = document.querySelectorAll(".quote-slide");
var currentSlide = 0;
var nextBtn = document.getElementById("next-btn");
var prevBtn = document.getElementById("prev-btn");
function moveToSlide(n) {
quotes[currentSlide].classList.remove("active-slide");
currentSlide = (n + quotes.length) % quotes.length;
quotes[currentSlide].classList.add("active-slide");
}
function nextSlide() {
moveToSlide(currentSlide + 1);
}
function prevSlide() {
moveToSlide(currentSlide - 1);
}
nextBtn.addEventListener("click", nextSlide);
prevBtn.addEventListener("click", prevSlide);
setInterval(nextSlide, 3000);
var swiper = new Swiper(".slide-container", {
slidesPerView: 4,
spaceBetween: 20,
sliderPerGroup: 4,
loop: true,
centerSlide: "true",
fade: "true",
grabCursor: "true",
pagination: {
el: ".swiper-pagination",
clickable: true,
dynamicBullets: true,
},
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
breakpoints: {
0: {
slidesPerView: 1,
},
520: {
slidesPerView: 2,
},
768: {
slidesPerView: 3,
},
1000: {
slidesPerView: 4,
},
},
});