١
هذا الالتزام موجود في:
51
index.js
Normal file
51
index.js
Normal file
@@ -0,0 +1,51 @@
|
||||
/* ============================================
|
||||
index.js - طلباتك بلس - الصفحة الرئيسية
|
||||
============================================ */
|
||||
|
||||
// ---- تأثير العداد (Counter Animation) ----
|
||||
function animateCounter(id, target, duration = 2000, suffix = '') {
|
||||
let start = 0;
|
||||
const increment = target / (duration / 16);
|
||||
const el = document.getElementById(id);
|
||||
|
||||
const timer = setInterval(() => {
|
||||
start += increment;
|
||||
if (start >= target) {
|
||||
clearInterval(timer);
|
||||
el.textContent = Math.floor(target) + suffix;
|
||||
} else {
|
||||
el.textContent = Math.floor(start) + suffix;
|
||||
}
|
||||
}, 16);
|
||||
}
|
||||
|
||||
// ---- مراقب التمرير للـ Fade-in والعدادات ----
|
||||
function setupScrollAnimations() {
|
||||
const observer = new IntersectionObserver((entries) => {
|
||||
entries.forEach(entry => {
|
||||
if (entry.isIntersecting) {
|
||||
entry.target.classList.add('visible');
|
||||
|
||||
if (entry.target.id === 'stats') {
|
||||
animateCounter('stat1', 35);
|
||||
animateCounter('stat2', 2800, 1800);
|
||||
animateCounter('stat3', 136);
|
||||
animateCounter('stat4', 93, 1200, '%');
|
||||
}
|
||||
}
|
||||
});
|
||||
}, { threshold: 0.3 });
|
||||
|
||||
document.querySelectorAll('section').forEach(section => {
|
||||
section.classList.add('fade-in');
|
||||
observer.observe(section);
|
||||
});
|
||||
|
||||
observer.observe(document.getElementById('stats'));
|
||||
}
|
||||
|
||||
// ---- تهيئة كل شيء عند تحميل الصفحة ----
|
||||
window.onload = function () {
|
||||
setupScrollAnimations();
|
||||
console.log('%c✅ موقع طلباتك بلس جاهز للاستخدام!', 'color:#ff661c; font-size:13px; font-weight:bold');
|
||||
};
|
||||
المرجع في مشكلة جديدة
حظر مستخدم