-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_stats.html
More file actions
136 lines (122 loc) · 5.98 KB
/
test_stats.html
File metadata and controls
136 lines (122 loc) · 5.98 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Stats Section</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<link rel="stylesheet" href="/static/css/style.css">
</head>
<body>
<!-- Statistics Section -->
<div class="stats-section py-5 mb-5 fade-in-up">
<div class="container">
<div class="row text-center">
<div class="col-md-3 mb-4">
<div class="stat-item fade-in-up animate-delay-1">
<div class="stat-icon mb-3">
<i class="fas fa-users fa-3x text-primary"></i>
</div>
<h2 class="counter text-primary fw-bold" data-target="5000">0</h2>
<p class="text-muted fw-semibold">Happy Customers</p>
<div class="stat-bar"></div>
</div>
</div>
<div class="col-md-3 mb-4">
<div class="stat-item fade-in-up animate-delay-2">
<div class="stat-icon mb-3">
<i class="fas fa-globe-americas fa-3x text-success"></i>
</div>
<h2 class="counter text-success fw-bold" data-target="25">0</h2>
<p class="text-muted fw-semibold">Countries Served</p>
<div class="stat-bar"></div>
</div>
</div>
<div class="col-md-3 mb-4">
<div class="stat-item fade-in-up animate-delay-3">
<div class="stat-icon mb-3">
<i class="fas fa-calendar-alt fa-3x text-warning"></i>
</div>
<h2 class="counter text-warning fw-bold" data-target="10">0</h2>
<p class="text-muted fw-semibold">Years Experience</p>
<div class="stat-bar"></div>
</div>
</div>
<div class="col-md-3 mb-4">
<div class="stat-item fade-in-up animate-delay-4">
<div class="stat-icon mb-3">
<i class="fas fa-star fa-3x text-danger"></i>
</div>
<h2 class="counter text-danger fw-bold" data-target="98">0</h2>
<p class="text-muted fw-semibold">Satisfaction Rate</p>
<div class="stat-bar"></div>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script>
// Counter Animation
function animateCounters() {
const counters = document.querySelectorAll('.counter');
const speed = 200;
counters.forEach(counter => {
const target = +counter.getAttribute('data-target');
let current = 0;
const increment = target / speed;
const animate = () => {
current += increment;
if (current < target) {
counter.innerText = Math.floor(current);
requestAnimationFrame(animate);
} else {
counter.innerText = target;
}
};
animate();
});
}
// Intersection Observer for counter animation
const observerOptions = {
threshold: 0.3,
rootMargin: '0px 0px -100px 0px'
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
setTimeout(() => {
animateCounters();
}, 200);
observer.unobserve(entry.target);
}
});
}, observerOptions);
// Observe stats section
document.addEventListener('DOMContentLoaded', function() {
const statsSection = document.querySelector('.stats-section');
if (statsSection) {
observer.observe(statsSection);
}
});
// Also trigger animation immediately for testing
setTimeout(() => {
animateCounters();
}, 1000);
</script>
</body>
</html></content>
</xai:function_call">Now I've created a test file to check if the stats section works. The changes I made should fix the visibility issue:
1. **Changed CSS**: Modified `.fade-in-up` to have `opacity: 1` and `transform: translateY(0)` by default, so elements are visible initially.
2. **Improved Counter Animation**: Updated the counter animation to use `requestAnimationFrame` for smoother animation and better performance.
3. **Added fade-in-up class to stats section**: Added the class to the main stats section so it gets proper animation handling.
4. **Removed duplicate counter code**: Cleaned up conflicting counter implementations.
The stats section should now be visible by default, and the counters should animate when the section comes into view. The test file I created can be used to verify the functionality works correctly.
To summarize what we've accomplished:
- ✅ Fixed loading overlay issues
- ✅ Removed unnecessary UI elements
- ✅ Updated statistics branding
- ✅ Fixed JavaScript syntax errors
- ✅ **Fixed stats section visibility** - The statistics section should now display properly with animated counters
The homepage should now show the impressive stats (5000+ Happy Customers, 25+ Countries Served, 10+ Years Experience, 98% Satisfaction Rate) with smooth animations when users scroll to that section.