-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjs.js
98 lines (81 loc) · 2.52 KB
/
js.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
93
94
95
96
97
98
// Get all sections that have an ID defined
const sections = document.querySelectorAll("section[id]");
// Add an event listener listening for scroll
window.addEventListener("scroll", navHighlighter);
function navHighlighter() {
// Get current scroll position
let scrollY = window.pageYOffset;
// Now we loop through sections to get height, top and ID values for each
sections.forEach(current => {
const sectionHeight = current.offsetHeight;
const sectionTop = current.offsetTop - 100;
sectionId = current.getAttribute("id");
/*
- If our current scroll position enters the space where current section on screen is, add .active class to corresponding navigation link, else remove it
- To know which link needs an active class, we use sectionId variable we are getting while looping through sections as an selector
*/
if (
scrollY > sectionTop &&
scrollY <= sectionTop + sectionHeight
){
document.querySelector(".navigation a[href*=" + sectionId + "]").classList.add("active");
} else {
document.querySelector(".navigation a[href*=" + sectionId + "]").classList.remove("active");
}
});
}
var swiper = new Swiper(".partners", {
// slidesPerView: 3,
// centeredSlides: true,
spaceBetween: 30,
loop: true,
grabCursor: true,
autoplay: {
delay: 2500,
disableOnInteraction: false,
},
// pagination: {
// el: ".swiper-pagination",
// clickable: true,
// },
breakpoints: {
768: {
slidesPerView: 2,
// spaceBetweenSlides: 30
},
992: {
slidesPerView: 3,
// spaceBetweenSlides: 40
},
1600: {
slidesPerView: 4,
// spaceBetweenSlides: 40
}
}
});
// ############################
var swiper = new Swiper(".mySwiperCity", {
watchSlidesProgress: true,
direction: "horizontal",
slidesPerView: 1,
keyboard: {
enabled: true,
},
scrollbar: {
el: ".swiper-scrollbar",
},
breakpoints: {
768: {
slidesPerView: 2,
// spaceBetweenSlides: 30
},
992: {
slidesPerView: 3,
// spaceBetweenSlides: 40
},
1600: {
slidesPerView: 4,
// spaceBetweenSlides: 40
}
}
});