-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
57 lines (46 loc) · 2.01 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
let searchForm = document.querySelector('.search-form');
document.querySelector('#search-btn').onclick = () =>{
searchForm.classList.toggle('active');
cart.classList.remove('active');
loginForm.classList.remove('active');
navbar.classList.remove('active');
}
let cart = document.querySelector('.shopping-cart');
document.querySelector('#cart-btn').onclick = () =>{
cart.classList.toggle('active');
searchForm.classList.remove('active');
loginForm.classList.remove('active');
navbar.classList.remove('active');
}
let loginForm = document.querySelector('.login-form');
document.querySelector('#login-btn').onclick = () =>{
loginForm.classList.toggle('active');
searchForm.classList.remove('active');
cart.classList.remove('active');
navbar.classList.remove('active');
}
let navbar = document.querySelector('.navbar');
document.querySelector('#menu-btn').onclick = () =>{
navbar.classList.toggle('active');
searchForm.classList.remove('active');
cart.classList.remove('active');
loginForm.classList.remove('active');
}
window.onscroll = () =>{
searchForm.classList.remove('active');
cart.classList.remove('active');
loginForm.classList.remove('active');
navbar.classList.remove('active');
}
let slides = document.querySelectorAll('.home .slides-container .slide');
let index = 0;
function next(){
slides[index].classList.remove('active');
index = (index + 1) % slides.length;
slides[index].classList.add('active');
}
function prev(){
slides[index].classList.remove('active');
index = (index - 1 + slides.length) % slides.length;
slides[index].classList.add('active');
}