-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
78 lines (64 loc) · 1.81 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
// NAV
var navToggle = document.querySelector(".nav-toggle");
var navIcon = document.querySelector(".navicon");
var primaryNavWrapper = document.querySelector(".primary-nav-wrapper");
navToggle.addEventListener("click", function () {
this.classList.toggle("active");
navIcon.classList.toggle("fixed");
primaryNavWrapper.classList.toggle("open");
});
var primaryNavLinks = document.querySelectorAll(".primary-nav-wrapper li a");
for (var i = 0; i < primaryNavLinks.length; i++) {
primaryNavLinks[i].addEventListener("click", function () {
// console.log('clicked');
navToggle.classList.toggle("active");
navIcon.classList.toggle("fixed");
primaryNavWrapper.classList.toggle("open");
});
}
// SMOOTH SCROLL
var scroll = new SmoothScroll('a[href*="#"]', {
speed: 1100,
speedAsDuration: true,
});
// HEIGHT OF THE HERO IMAGE
// 100VH MOBILE FIX
// THIS FIXES THE BUG ON iOS Safari WHERE THE ADDRESS BAR (CHIN) TAKES UP A PORTION OF THE SCREEN
// FIND THE FULL HEIGHT OF THE VIEWPORT
var fullHeight = window.innerHeight;
// TARGET THE INTRO
var headerBg = document.getElementById("headerBg");
// APPLY THE FULL HEIGHT TO THE INTRO
headerBg.style.height = fullHeight + "px";
// SWIPER
const swiper = new Swiper(".swiper", {
// Optional parameters
// autoplay: {
// delay: 5000,
// },
grabCursor: true,
spaceBetween: 320,
speed: 600,
loop: true,
// effect: "fade",
// fadeEffect: {
// crossFade: true,
// },
// If we need pagination
pagination: {
el: ".swiper-pagination",
clickable: true,
},
// Navigation arrows
navigation: {
nextEl: ".swiper-button-next",
prevEl: ".swiper-button-prev",
},
// And if we need scrollbar
// scrollbar: {
// el: ".swiper-scrollbar",
// },
});
// WRITE THE YEAR IN THE FOOTER
var thisYear = new Date().getFullYear();
document.getElementById("year").innerHTML = thisYear;