document.addEventListener('DOMContentLoaded', function () { // تأثير التحويم على البنرات const banners = document.querySelectorAll('.custom-banner'); banners.forEach(banner => { // تحريك عند التحويم banner.addEventListener('mouseenter', function () { this.style.transform = 'translateY(-5px)'; this.style.boxShadow = '0 8px 20px rgba(0,0,0,0.15)'; }); banner.addEventListener('mouseleave', function () { this.style.transform = 'translateY(0)'; this.style.boxShadow = '0 4px 12px rgba(0,0,0,0.1)'; }); // ضبط ارتفاع الصورة const img = banner.querySelector('img'); if (img) { img.style.height = window.innerWidth > 768 ? '300px' : '150px'; } }); // إعادة ضبط ارتفاع الصور عند تغيير حجم الشاشة window.addEventListener('resize', function () { document.querySelectorAll('.custom-banner img').forEach(img => { img.style.height = window.innerWidth > 768 ? '300px' : '150px'; }); }); // تأخير التحقق من السلايدر حتى يتم تحميله من Swiper setTimeout(() => { const isDesktop = window.innerWidth > 1024; if (isDesktop) { const swiperContainer = document.querySelector('#main-links-5 .swiper'); if (swiperContainer && swiperContainer.swiper) { const swiperElement = swiperContainer.swiper; // إيقاف التشغيل التلقائي if (swiperElement.autoplay) swiperElement.autoplay.stop(); // منع السحب والتحكم بالماوس swiperElement.allowTouchMove = false; swiperElement.mousewheel.disable(); } } }, 500); // تأخير نصف ثانية كافي عادة لتحميل Swiper });