-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
83 lines (65 loc) · 2.76 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
// Pages
document.querySelectorAll('.logo').forEach(logo => {
logo.addEventListener('click', () => {
document.querySelector('.front-page').style.display = 'block'
document.querySelector('.login-page').style.display = 'none'
document.querySelector('.signup-page').style.display = 'none'
})
})
document.querySelectorAll('.login').forEach(loginBtn => {
loginBtn.addEventListener('click', () => {
document.querySelector('.front-page').style.display = 'none'
document.querySelector('.login-page').style.display = 'block'
document.querySelector('.signup-page').style.display = 'none'
})
})
document.querySelectorAll('.signup').forEach(signupBtn => {
signupBtn.addEventListener('click', () => {
document.querySelector('.front-page').style.display = 'none'
document.querySelector('.login-page').style.display = 'none'
document.querySelector('.signup-page').style.display = 'flex'
})
})
// End of Pages
// Navigation
const dropdownItems = document.querySelectorAll('.dropdown-hover')
if(window.innerWidth < 1000) {
const menuIcon = document.querySelector('.menu')
const navbar = document.querySelector('.navbar')
menuIcon.addEventListener('click', () => {
navbar.classList.toggle('change')
if(!navbar.classList.contains('change')) {
document.querySelectorAll('.nav-dropdown').forEach(dropdown => {
dropdown.style.left = '-20rem'
})
}
})
document.querySelectorAll('.show-dropdown').forEach(link => {
link.addEventListener('click', () => {
link.nextElementSibling.style.left = '0'
})
})
document.querySelectorAll('.dropdown-heading-link').forEach(headingLink => {
headingLink.addEventListener('click', () => {
headingLink.parentElement.parentElement.style.left = '-20rem'
})
})
} else {
dropdownItems.forEach(dropdownItem => {
dropdownItem.addEventListener('mouseover', () => {
dropdownItem.lastElementChild.style.cssText = 'opacity: 1; visibility: visible'
document.querySelector('.navbar-wrapper').style.background = 'linear-gradient(to right, #066399, #2f8fdf, #066399)'
dropdownItem.firstElementChild.firstElementChild.style.transform = 'rotate(180deg)'
})
dropdownItem.addEventListener('mouseout', () => {
dropdownItem.lastElementChild.style.cssText = 'opacity: 0; visibility: hidden'
document.querySelector('.navbar-wrapper').style.background = 'none'
dropdownItem.firstElementChild.firstElementChild.style.transform = 'rotate(0)'
})
})
}
window.addEventListener('resize', () => {
window.location.reload()
})
// End of Navigation
// End of Navigation