-
Notifications
You must be signed in to change notification settings - Fork 37
/
script.js
127 lines (117 loc) · 3.73 KB
/
script.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// PreLoader
const preloader = document.querySelector(".preloader");
var intervalId;
// calling timer on DOM load
window.addEventListener(
"load",
function () {
intervalId = setInterval(fadeEffect, 300);
},
false
);
function fadeEffect() {
if (!preloader.style.opacity) {
preloader.style.opacity = 1;
}
if (preloader.style.opacity > 0) {
preloader.style.opacity -= 0.1;
} else {
preloader.parentNode.removeChild(preloader);
clearInterval(intervalId);
}
}
var sidenav = document.getElementById("sideNav");
var main = document.getElementById("main");
var menu = document.getElementById("menuBtn");
var footer = document.getElementById("footer");
var landingbar = document.getElementById("landingbar").querySelector(".desktop-page-bar");
function openNav() {
sidenav.style.width = "250px";
main.style.transform = "translateX(-250px)";
main.style.transition = "transform 1s";
footer.style.transform = "translateX(-250px)";
footer.style.transition = "transform 1s";
landingbar.style.transform= "translateX(-250px)";
landingbar.style.transition = "transform 1s";
menu.onclick = function () {
closeNav();
};
menu.className = "far fa-times-circle";
}
function closeNav() {
sidenav.style.width = "0";
main.style.transform = "translateX(0)";
main.style.transition = "transform 0.3s";
footer.style.transform = "translateX(0)";
footer.style.transition = "transform 0.3s";
landingbar.style.transform= "translateX(0)";
menu.onclick = function () {
openNav();
};
menu.className = "fas fa-bars";
}
var scroll = new SmoothScroll('a[href*="#"]', {
speed: 500,
speedAsDuration: true,
});
// var prevScrollpos = window.pageYOffset;
window.onscroll = function () {
if (document.body.scrollTop > 90 || document.documentElement.scrollTop > 90) {
// var currentScrollPos = window.pageYOffset;
// if (prevScrollpos > currentScrollPos) {
// document.getElementById("top-navbar").style.top = "0";
// } else {
// document.getElementById("top-navbar").style.top = "-80px";
// }
// prevScrollpos = currentScrollPos;
document.getElementById("landingbar").style.background =
"rgba(156, 181, 238,1)";
document
.getElementById("landingbar")
.querySelector(".desktop-page-bar > ul").style.color = "white";
document.getElementById("landingbar").style.height = "70px";
document.getElementById("landingbar").style.paddingTop = "0px";
document
.getElementById("landingbar")
.querySelector(".desktop-page-bar > ul").style.marginTop = "20px";
document
.getElementById("landingbar")
.querySelector(".desktop-page-bar img").style.maxWidth = "80%";
} else {
// document.getElementById("top-navbar").style.top = "-80px";
document.getElementById("landingbar").style.background =
"rgba(255,0,150,0.0)";
document.getElementById("landingbar").style.height = "90px";
document.getElementById("landingbar").style.paddingTop = "20px";
document
.getElementById("landingbar")
.querySelector(".desktop-page-bar > ul").style.marginTop = "0px";
document
.getElementById("landingbar")
.querySelector(".desktop-page-bar img").style.maxWidth = "100%";
}
};
// Initialize Swiper
var swiper = new Swiper(".swiper-container", {
effect: "coverflow",
grabCursor: true,
centeredSlides: true,
slidesPerView: "auto",
coverflowEffect: {
rotate: 50,
stretch: 0,
depth: 100,
modifier: 1,
slideShadows: false,
},
pagination: {
el: ".swiper-pagination",
},
});
//Dark mode
function toggleDarkLight() {
var body = document.getElementById("body");
var currentClass = body.className;
body.className = currentClass == "dark-mode" ? "light-mode" : "dark-mode";
}
var tilt = $(".js-tilt").tilt();