-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
99 lines (87 loc) · 3 KB
/
Copy pathscript.js
File metadata and controls
99 lines (87 loc) · 3 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
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
document.addEventListener('DOMContentLoaded', () => {
const header = document.getElementById('main-header');
const sections = document.querySelectorAll('section');
const navLinks = document.querySelectorAll('.nav-links a');
// Scroll effect for header
window.addEventListener('scroll', () => {
if (window.scrollY > 50) {
header.classList.add('scrolled');
} else {
header.classList.remove('scrolled');
}
// Active link highlighting
let current = '';
sections.forEach(section => {
const sectionTop = section.offsetTop;
const sectionHeight = section.clientHeight;
if (window.scrollY >= sectionTop - 100) {
current = section.getAttribute('id');
}
});
navLinks.forEach(link => {
link.classList.remove('active');
if (link.getAttribute('href').includes(current)) {
link.classList.add('active');
}
});
});
// Mobile Menu Toggle
const mobileMenuBtn = document.getElementById('mobile-menu');
const navLinksList = document.querySelector('.nav-links');
if (mobileMenuBtn) {
mobileMenuBtn.addEventListener('click', () => {
navLinksList.classList.toggle('active');
});
// Close menu when clicking a link
navLinksList.querySelectorAll('a').forEach(link => {
link.addEventListener('click', () => {
navLinksList.classList.remove('active');
});
});
}
// Smooth scroll for start button (only on index)
const startBtn = document.getElementById('start-guide');
if (startBtn) {
startBtn.addEventListener('click', () => {
document.getElementById('materiais').scrollIntoView({ behavior: 'smooth' });
});
}
// Intersection Observer for fade-in animations
const observerOptions = {
threshold: 0.1
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate-in');
}
});
}, observerOptions);
sections.forEach(section => {
section.classList.add('reveal-on-scroll');
observer.observe(section);
});
// Adding dynamic writing effect to mockup
const writingLines = document.querySelectorAll('.writing-lines span');
writingLines.forEach((line, index) => {
line.style.transitionDelay = `${index * 0.1}s`;
});
});
// Adding styles for reveal animation dynamically
const style = document.createElement('style');
style.textContent = `
.reveal-on-scroll {
opacity: 0;
transform: translateY(30px);
transition: opacity 0.8s ease, transform 0.8s ease;
}
.animate-in {
opacity: 1;
transform: translateY(0);
}
.nav-links a.active {
color: #e67e22;
font-weight: 700;
}
`;
document.head.appendChild(style);