-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathindex.js
68 lines (53 loc) · 1.62 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
$(document).ready(function() {
//Preloader
preloaderFadeOutTime = 500;
function hidePreloader() {
var preloader = $('.spinner-wrapper');
preloader.fadeOut(preloaderFadeOutTime);
}
hidePreloader();
});
function darkMode() {
var element = document.body;
element.className = "dark-mode";
let bg = document.querySelector('.nav-list');
bg.style. background = 'linear-gradient(45deg, #efdbdb, #00838f)';
}
function lightMode() {
var element = document.body;
element.className = "light-mode";
let bg = document.querySelector('.nav-list');
bg.style. background = 'linear-gradient(45deg, #efdbdb, #f97a7a)';
}
<<<<<<< HEAD
=======
>>>>>>> bab1f0d5f23c281dc82484a076ea70fa2fa87b0d
window.addEventListener('resize', function(){
addRequiredClass();
})
function addRequiredClass() {
if (window.innerWidth < 1210) {
document.body.classList.add('mobile')
} else {
document.body.classList.remove('mobile')
}
}
window.onload = addRequiredClass
let hamburger = document.querySelector('.hamburger')
let mobileNav = document.querySelector('.nav-list')
let bars = document.querySelectorAll('.hamburger div')
let isActive = false
hamburger.addEventListener('click', function() {
mobileNav.classList.toggle('open')
if(!isActive) {
bars[0].style.transform = 'rotate(45deg)'
bars[1].style.opacity = '0'
bars[2].style.transform = 'rotate(-45deg)'
isActive = true
} else {
bars[0].style.transform = 'rotate(0deg)'
bars[1].style.opacity = '1'
bars[2].style.transform = 'rotate(0deg)'
isActive = false
}
})