-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
267 lines (230 loc) · 8.22 KB
/
script.js
File metadata and controls
267 lines (230 loc) · 8.22 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
// Mobile Menu Toggle
const hamburger = document.querySelector('.hamburger');
const navMenu = document.querySelector('.nav-menu');
hamburger.addEventListener('click', () => {
navMenu.classList.toggle('active');
// Animate hamburger
const spans = hamburger.querySelectorAll('span');
if (navMenu.classList.contains('active')) {
spans[0].style.transform = 'rotate(45deg) translateY(10px)';
spans[1].style.opacity = '0';
spans[2].style.transform = 'rotate(-45deg) translateY(-10px)';
} else {
spans[0].style.transform = 'none';
spans[1].style.opacity = '1';
spans[2].style.transform = 'none';
}
});
// Close menu when clicking on a link
document.querySelectorAll('.nav-menu a').forEach(link => {
link.addEventListener('click', () => {
navMenu.classList.remove('active');
const spans = hamburger.querySelectorAll('span');
spans[0].style.transform = 'none';
spans[1].style.opacity = '1';
spans[2].style.transform = 'none';
});
});
// Navbar scroll effect
let lastScroll = 0;
const navbar = document.querySelector('.navbar');
window.addEventListener('scroll', () => {
const currentScroll = window.pageYOffset;
if (currentScroll > 100) {
navbar.style.padding = '10px 0';
navbar.style.boxShadow = '0 2px 30px rgba(0, 0, 0, 0.1)';
} else {
navbar.style.padding = '20px 0';
navbar.style.boxShadow = '0 2px 20px rgba(0, 0, 0, 0.05)';
}
lastScroll = currentScroll;
});
// Tabs functionality
const tabButtons = document.querySelectorAll('.tab-btn');
const tabContents = document.querySelectorAll('.tab-content');
tabButtons.forEach(button => {
button.addEventListener('click', () => {
const targetTab = button.getAttribute('data-tab');
// Remove active class from all buttons and contents
tabButtons.forEach(btn => btn.classList.remove('active'));
tabContents.forEach(content => content.classList.remove('active'));
// Add active class to clicked button and corresponding content
button.classList.add('active');
document.getElementById(targetTab).classList.add('active');
});
});
// Intersection Observer for scroll animations
const observerOptions = {
threshold: 0.1,
rootMargin: '0px 0px -100px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateY(0)';
}
});
}, observerOptions);
// Observe all fade-in-up elements
document.querySelectorAll('.fade-in-up').forEach(element => {
element.style.opacity = '0';
element.style.transform = 'translateY(30px)';
element.style.transition = 'all 0.8s ease-out';
observer.observe(element);
});
// Smooth scroll for anchor links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const target = document.querySelector(this.getAttribute('href'));
if (target) {
const offsetTop = target.offsetTop - 80;
window.scrollTo({
top: offsetTop,
behavior: 'smooth'
});
}
});
});
// Counter animation for stats
function animateCounter(element, target, duration = 2000) {
let start = 0;
const increment = target / (duration / 16);
const timer = setInterval(() => {
start += increment;
if (start >= target) {
element.textContent = target;
clearInterval(timer);
} else {
element.textContent = Math.floor(start);
}
}, 16);
}
// Parallax effect for hero background
window.addEventListener('scroll', () => {
const scrolled = window.pageYOffset;
const heroBg = document.querySelector('.hero-bg');
if (heroBg) {
heroBg.style.transform = `translateY(${scrolled * 0.5}px)`;
}
});
// Add hover effect to cards
document.querySelectorAll('.problem-card, .benefit-card, .revenue-card').forEach(card => {
card.addEventListener('mouseenter', function() {
this.style.transform = 'translateY(-5px)';
});
card.addEventListener('mouseleave', function() {
this.style.transform = 'translateY(0)';
});
});
// Animate workflow steps on scroll
const workflowSteps = document.querySelectorAll('.workflow-step');
const workflowObserver = new IntersectionObserver((entries) => {
entries.forEach((entry, index) => {
if (entry.isIntersecting) {
setTimeout(() => {
entry.target.style.opacity = '1';
entry.target.style.transform = 'translateX(0)';
}, index * 200);
}
});
}, observerOptions);
workflowSteps.forEach(step => {
step.style.opacity = '0';
step.style.transform = 'translateX(-30px)';
step.style.transition = 'all 0.6s ease-out';
workflowObserver.observe(step);
});
// Phone mockup animation
const phoneMockup = document.querySelector('.phone-mockup');
if (phoneMockup) {
const phoneObserver = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.style.animation = 'float 3s ease-in-out infinite';
}
});
}, observerOptions);
phoneObserver.observe(phoneMockup);
}
// Add floating animation
const style = document.createElement('style');
style.textContent = `
@keyframes float {
0%, 100% {
transform: translateY(0px);
}
50% {
transform: translateY(-20px);
}
}
`;
document.head.appendChild(style);
// Add loading animation
window.addEventListener('load', () => {
document.body.style.opacity = '0';
setTimeout(() => {
document.body.style.transition = 'opacity 0.5s ease';
document.body.style.opacity = '1';
}, 100);
});
// Chart bars animation
const chartBars = document.querySelectorAll('.chart-bar');
const chartObserver = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
chartBars.forEach((bar, index) => {
setTimeout(() => {
bar.style.animation = 'growUp 1s ease-out forwards';
}, index * 200);
});
}
});
}, observerOptions);
const growthChart = document.querySelector('.growth-chart');
if (growthChart) {
chartObserver.observe(growthChart);
}
// Add click tracking for investor interest
const investorButtons = document.querySelectorAll('[href="#contato"]');
investorButtons.forEach(button => {
button.addEventListener('click', () => {
console.log('Investor interest captured at:', new Date().toISOString());
// Here you could add analytics tracking or send to a backend
});
});
// Feature showcase cycling
const features = document.querySelectorAll('.feature-item');
let currentFeature = 0;
function highlightFeature() {
features.forEach((feature, index) => {
if (index === currentFeature) {
feature.style.transform = 'scale(1.05)';
feature.style.transition = 'transform 0.3s ease';
} else {
feature.style.transform = 'scale(1)';
}
});
currentFeature = (currentFeature + 1) % features.length;
}
// Subtle feature highlighting every 3 seconds
setInterval(highlightFeature, 3000);
// Add cursor effect for interactive elements
document.querySelectorAll('.btn, .tab-btn, .nav-menu a').forEach(element => {
element.style.cursor = 'pointer';
});
// Console message for developers
console.log('%c🚀 WaiterNow MVP', 'font-size: 20px; color: #2E5CFF; font-weight: bold;');
console.log('%cInteressado em investir? Entre em contato: +55 61 99663-4944', 'font-size: 14px; color: #64748B;');
// Add performance monitoring
if ('PerformanceObserver' in window) {
const perfObserver = new PerformanceObserver((list) => {
for (const entry of list.getEntries()) {
if (entry.duration > 100) {
console.warn('Slow interaction detected:', entry.name, entry.duration + 'ms');
}
}
});
perfObserver.observe({ entryTypes: ['measure', 'navigation'] });
}