-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
48 lines (40 loc) · 1.39 KB
/
Copy pathscript.js
File metadata and controls
48 lines (40 loc) · 1.39 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
42
43
44
45
46
47
48
function mudarVideo(direcao) {
const slides = document.querySelectorAll('.video-slide');
let ativoIndex = Array.from(slides).findIndex(slide => slide.classList.contains('ativo'));
// Remove ativo e pausa todos os vídeos
slides.forEach(slide => {
slide.classList.remove('ativo');
const video = slide.querySelector('video');
video.pause();
video.currentTime = 0; // volta ao início
});
// Calcula o novo índice
ativoIndex = (ativoIndex + direcao + slides.length) % slides.length;
// Adiciona ativo ao slide correto
slides[ativoIndex].classList.add('ativo');
}
function togglePlay(button) {
const video = button.previousElementSibling; // pega o <video>
if (video.paused) {
// pausa todos os outros antes
document.querySelectorAll('video').forEach(v => {
v.pause();
v.currentTime = 0;
});
video.play();
button.innerHTML = '<i class="fa-solid fa-pause"></i>';
} else {
video.pause();
button.innerHTML = '<i class="fa-solid fa-play"></i>';
}
}
function mostrarPagina(paginaId) {
const paginas = document.querySelectorAll('.pagina');
paginas.forEach(pagina => {
pagina.style.display = 'none';
});
const paginaSelecionada = document.getElementById(paginaId);
if (paginaSelecionada) {
paginaSelecionada.style.display = 'block';
}
}