@@ -80,36 +80,37 @@ document.addEventListener('DOMContentLoaded', () => {
8080 } ) ;
8181
8282 // 4. Statistics Counter Animation
83- const statNumbers = document . querySelectorAll ( '.stat-number ' ) ;
83+ const statNumbers = document . querySelectorAll ( '.stat-counter ' ) ;
8484 const animateCounters = ( element ) => {
8585 const target = parseInt ( element . getAttribute ( 'data-target' ) , 10 ) ;
86- const suffix = element . textContent . includes ( '%' ) ? '%' : ( element . textContent . includes ( 'x' ) ? 'x' : '' ) ;
86+ const prefix = element . getAttribute ( 'data-prefix' ) || '' ;
87+ const suffix = element . getAttribute ( 'data-suffix' ) || '' ;
8788 let current = 0 ;
88- const duration = 2000 ; // 2 seconds
89+ const duration = 1500 ; // 1.5 seconds
8990 const stepTime = Math . max ( Math . floor ( duration / target ) , 15 ) ;
9091
9192 const timer = setInterval ( ( ) => {
9293 current += 1 ;
93- element . textContent = current + suffix ;
94+ element . textContent = prefix + current + suffix ;
9495 if ( current >= target ) {
95- element . textContent = target + suffix ;
96+ element . textContent = prefix + target + suffix ;
9697 clearInterval ( timer ) ;
9798 }
9899 } , stepTime ) ;
99100 } ;
100101
101- const statsSection = document . getElementById ( 'stats ' ) ;
102- if ( statsSection ) {
102+ const manifestoSection = document . getElementById ( 'manifesto ' ) ;
103+ if ( manifestoSection ) {
103104 const statsObserver = new IntersectionObserver ( ( entries , observer ) => {
104105 entries . forEach ( entry => {
105106 if ( entry . isIntersecting ) {
106107 statNumbers . forEach ( num => animateCounters ( num ) ) ;
107108 observer . unobserve ( entry . target ) ;
108109 }
109110 } ) ;
110- } , { threshold : 0.3 } ) ;
111+ } , { threshold : 0.15 } ) ;
111112
112- statsObserver . observe ( statsSection ) ;
113+ statsObserver . observe ( manifestoSection ) ;
113114 }
114115
115116 // 5. Dynamic Collaboration Form Submission
@@ -131,7 +132,7 @@ document.addEventListener('DOMContentLoaded', () => {
131132 setTimeout ( ( ) => {
132133 card . innerHTML = `
133134 <div style="text-align: center; padding: 2rem 0;">
134- <div style="width: 80px; height: 80px; background: rgba(98, 196, 49 , 0.1); border: 2px solid var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 2rem; color: var(--primary); font-size: 2.5rem; animation: pulse-glow 2s infinite;">
135+ <div style="width: 80px; height: 80px; background: rgba(var(--primary-rgb) , 0.1); border: 2px solid var(--primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 2rem; color: var(--primary); font-size: 2.5rem; animation: pulse-glow 2s infinite;">
135136 <i class="fa-solid fa-check"></i>
136137 </div>
137138 <h3 style="font-size: 1.8rem; margin-bottom: 1rem; color: var(--text-primary);">Đăng Ký Thành Công!</h3>
@@ -191,13 +192,13 @@ const styleSheet = document.createElement("style");
191192styleSheet . textContent = `
192193@keyframes pulse-glow {
193194 0% {
194- box-shadow: 0 0 0 0 rgba(98, 196, 49 , 0.4);
195+ box-shadow: 0 0 0 0 rgba(var(--primary-rgb) , 0.4);
195196 }
196197 70% {
197- box-shadow: 0 0 0 15px rgba(98, 196, 49 , 0);
198+ box-shadow: 0 0 0 15px rgba(var(--primary-rgb) , 0);
198199 }
199200 100% {
200- box-shadow: 0 0 0 0 rgba(98, 196, 49 , 0);
201+ box-shadow: 0 0 0 0 rgba(var(--primary-rgb) , 0);
201202 }
202203}
203204` ;
0 commit comments