-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
59 lines (52 loc) · 1.94 KB
/
Copy pathscript.js
File metadata and controls
59 lines (52 loc) · 1.94 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
49
50
51
52
53
54
55
56
57
58
59
// script.js - Funcionalidades principais do site
// Menu mobile toggle
document.addEventListener('DOMContentLoaded', function () {
const menuToggle = document.querySelector('.menu-toggle');
const menuItems = document.querySelector('.menu-items');
if (menuToggle && menuItems) {
menuToggle.addEventListener('click', function () {
menuItems.classList.toggle('show');
// Animação GSAP para o botão
gsap.to(menuToggle, {
rotation: menuItems.classList.contains('show') ? 90 : 0,
duration: 0.3,
ease: "power2.inOut"
});
});
}
// Fechar menu ao clicar em links (mobile)
if (menuItems) {
menuItems.querySelectorAll('a').forEach(link => {
link.addEventListener('click', () => {
if (menuItems.classList.contains('show')) {
menuItems.classList.remove('show');
if (menuToggle) {
gsap.to(menuToggle, {
rotation: 0,
duration: 0.3,
ease: "power2.inOut"
});
}
}
});
});
}
// Ano atual no footer
document.getElementById('currentYear').textContent = new Date().getFullYear();
});
// Smooth scroll para links âncora
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
// Ignorar se for botão de navegação do carrossel ou outros elementos não-link
if (this.tagName !== 'A') return;
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
gsap.to(window, {
duration: 1,
scrollTo: target,
ease: "power2.inOut"
});
}
});
});