-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
38 lines (27 loc) · 957 Bytes
/
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
// mobile nav 🍔
const navBtn = document.querySelector('.nav_buttons');
const nav = document.querySelector('nav');
const navItems = document.querySelectorAll('.nav_links')
const body = document.querySelector('body');
navBtn.addEventListener('click', () => {
nav.classList.toggle('open');
body.classList.toggle('open')
})
navItems.forEach(item => {
item.addEventListener('click', () => {
nav.classList.toggle('open')
body.classList.toggle('open')
})
})
// mobile slider
const imgCard = document.querySelectorAll('.card_item');
const dotNav = document.querySelectorAll('.dots');
dotNav.forEach((dot, index) => {
dot.addEventListener('click', () => {
dotNav.forEach(dot => dot.classList.remove('active'))
!dot.classList.contains('active') ?
dot.classList.add('active') : console.log('💩')
imgCard.forEach((card) => card.classList.remove('active_card'))
imgCard[index].classList.add('active_card');
})
})