-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
41 lines (33 loc) · 1.24 KB
/
Copy pathscript.js
File metadata and controls
41 lines (33 loc) · 1.24 KB
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
const menu = document.querySelectorAll('.menu ul li a');
const sections = document.querySelectorAll('section');
const modalVideo = document.querySelector('.modal');
const video = document.querySelector('.modal-video video')
const buttonModalVideo = document.getElementById('button-video');
const buttonCloseModal = document.getElementById('close_modal');
const pageOff = document.querySelector('.pageOff');
menuList = Array.from(menu);
menuList.map((link) => {
link.addEventListener('click', () => {
let sectionTarget = document.querySelector(link.attributes.href.value)
sections.forEach((section) => {
section.classList.remove('ativo');
})
sectionTarget.classList.add('ativo')
})
})
buttonModalVideo.addEventListener('click', () => {
modalVideo.classList.add('ativo')
video.setAttribute("autoplay", "true");
video.setAttribute("loop", "true");
})
buttonCloseModal.addEventListener('click', () => {
modalVideo.classList.remove('ativo')
video.removeAttribute("autoplay");
video.removeAttribute("loop");
})
window.addEventListener('offline', function() {
pageOff.classList.add('ativo');
});
window.addEventListener('online', function() {
pageOff.classList.remove('ativo');
});