-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
118 lines (100 loc) · 3.49 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
const hamburger = document.querySelector('.hamburger');
const navLinks = document.querySelector('.nav-links');
const navItems = document.querySelectorAll('.nav-links li');
hamburger.addEventListener('click', () => {
navLinks.classList.toggle('nav-active');
hamburger.classList.toggle('toggle');
});
// Adiciona um evento de clique a cada item do menu
navItems.forEach(item => {
item.addEventListener('click', () => {
navLinks.classList.remove('nav-active');
hamburger.classList.remove('toggle');
});
});
// hero
// Lista de vídeos (IDs dos shorts)
const shorts = [
"6uO72zt3WBk", // Primeiro vídeo
"faXzF9AWc7c" // Segundo vídeo
];
let currentIndex = 0; // Índice inicial
// Elementos
const iframe = document.getElementById('youtube-short');
const prevButton = document.getElementById('prev');
const nextButton = document.getElementById('next');
// Função para mudar o vídeo
function updateVideo(index) {
iframe.src = `https://www.youtube.com/embed/${shorts[index]}?autoplay=1`;
}
// Eventos dos botões
prevButton.addEventListener('click', () => {
if (currentIndex > 0) {
currentIndex--;
updateVideo(currentIndex);
}
});
nextButton.addEventListener('click', () => {
if (currentIndex < shorts.length - 1) {
currentIndex++;
updateVideo(currentIndex);
}
});
// about
document.addEventListener('DOMContentLoaded', function () {
const elements = document.querySelectorAll('.about-section, .card');
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = 1;
entry.target.style.transform = 'translateY(0)';
}
});
}, { threshold: 0.1 });
elements.forEach(element => {
element.style.opacity = 0;
element.style.transform = 'translateY(20px)';
observer.observe(element);
});
});
// gallery
document.addEventListener('DOMContentLoaded', () => {
const filterButtons = document.querySelectorAll('.filter-btn');
const galleryItems = document.querySelectorAll('.gallery-item');
filterButtons.forEach(button => {
button.addEventListener('click', () => {
const filter = button.getAttribute('data-filter');
filterButtons.forEach(btn => btn.classList.remove('active'));
button.classList.add('active');
galleryItems.forEach(item => {
if (filter === 'all' || item.classList.contains(filter)) {
item.style.display = 'block';
} else {
item.style.display = 'none';
}
});
});
});
// Lightbox functionality can be added here
});
document.addEventListener('DOMContentLoaded', function () {
const options = {
root: null,
rootMargin: '0px',
threshold: 0.1
};
const observer = new IntersectionObserver((entries, observer) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animated');
observer.unobserve(entry.target); // Stop observing once animated
}
});
}, options);
// Select elements to animate
const elements = document.querySelectorAll('.about-text, .about-image, .card, .gallery-item, .testimonial-card');
elements.forEach(element => {
element.classList.add('animate-on-scroll');
observer.observe(element);
});
});