Os números cadastrodos devem estar a contar se são 300 devem contar 302 3 4 sussivamente - Follow Up Deployment
Browse files- index.html +32 -2
index.html
CHANGED
@@ -185,11 +185,11 @@
|
|
185 |
<p>Pessoas Cadastradas</p>
|
186 |
</div>
|
187 |
<div class="card">
|
188 |
-
<h2>18</h2>
|
189 |
<p>Pessoas Ativas</p>
|
190 |
</div>
|
191 |
<div class="card">
|
192 |
-
<h2>25</h2>
|
193 |
<p>Cadastradas Hoje</p>
|
194 |
</div>
|
195 |
<div class="card">
|
@@ -285,16 +285,46 @@
|
|
285 |
</main>
|
286 |
|
287 |
<script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
288 |
const form = document.getElementById('formCadastro');
|
289 |
const msgSaldoInsuficiente = document.getElementById('msgSaldoInsuficiente');
|
290 |
const msgSucesso = document.getElementById('msgSucesso');
|
291 |
const btnAtivarVoucher = document.getElementById('btnAtivarVoucher');
|
|
|
292 |
|
293 |
form.addEventListener('submit', function(event) {
|
294 |
event.preventDefault();
|
295 |
// Simular cadastro bem sucedido e esconder saldo insuficiente
|
296 |
msgSaldoInsuficiente.style.display = 'none';
|
297 |
msgSucesso.style.display = 'block';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
});
|
299 |
|
300 |
btnAtivarVoucher.addEventListener('click', function() {
|
|
|
185 |
<p>Pessoas Cadastradas</p>
|
186 |
</div>
|
187 |
<div class="card">
|
188 |
+
<h2 style="color: #4CAF50;">18</h2>
|
189 |
<p>Pessoas Ativas</p>
|
190 |
</div>
|
191 |
<div class="card">
|
192 |
+
<h2 id="cadastradasHoje">25</h2>
|
193 |
<p>Cadastradas Hoje</p>
|
194 |
</div>
|
195 |
<div class="card">
|
|
|
285 |
</main>
|
286 |
|
287 |
<script>
|
288 |
+
// Initialize counters and make them increment sequentially
|
289 |
+
document.addEventListener('DOMContentLoaded', function() {
|
290 |
+
const counters = [
|
291 |
+
{ element: document.querySelector('.card:nth-child(1) h2'), value: 3000, interval: 5000 },
|
292 |
+
{ element: document.querySelector('.card:nth-child(2) h2'), value: 18, interval: 10000 },
|
293 |
+
{ element: document.querySelector('.card:nth-child(4) h2'), value: 120, interval: 7000 },
|
294 |
+
{ element: document.querySelector('.card:nth-child(5) h2'), value: 75, interval: 9000 }
|
295 |
+
];
|
296 |
+
|
297 |
+
counters.forEach(counter => {
|
298 |
+
counter.element.textContent = counter.value.toLocaleString();
|
299 |
+
|
300 |
+
setInterval(() => {
|
301 |
+
counter.value++;
|
302 |
+
counter.element.textContent = counter.value.toLocaleString();
|
303 |
+
}, counter.interval);
|
304 |
+
});
|
305 |
+
});
|
306 |
+
|
307 |
const form = document.getElementById('formCadastro');
|
308 |
const msgSaldoInsuficiente = document.getElementById('msgSaldoInsuficiente');
|
309 |
const msgSucesso = document.getElementById('msgSucesso');
|
310 |
const btnAtivarVoucher = document.getElementById('btnAtivarVoucher');
|
311 |
+
const cadastradasHoje = document.getElementById('cadastradasHoje');
|
312 |
|
313 |
form.addEventListener('submit', function(event) {
|
314 |
event.preventDefault();
|
315 |
// Simular cadastro bem sucedido e esconder saldo insuficiente
|
316 |
msgSaldoInsuficiente.style.display = 'none';
|
317 |
msgSucesso.style.display = 'block';
|
318 |
+
// Increment counter with animation
|
319 |
+
const currentCount = parseInt(cadastradasHoje.textContent);
|
320 |
+
cadastradasHoje.textContent = (currentCount + 1).toString();
|
321 |
+
|
322 |
+
// Animate the counter briefly
|
323 |
+
cadastradasHoje.style.transform = 'scale(1.2)';
|
324 |
+
cadastradasHoje.style.transition = 'transform 0.3s ease';
|
325 |
+
setTimeout(() => {
|
326 |
+
cadastradasHoje.style.transform = 'scale(1)';
|
327 |
+
}, 300);
|
328 |
});
|
329 |
|
330 |
btnAtivarVoucher.addEventListener('click', function() {
|