@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;700;900&display=swap'); .mk2-gallery.gallery-wrap { width: 100%; max-width: 860px; margin: 0 auto; font-family: 'Tajawal', sans-serif; direction: rtl; } .mk2-gallery .gallery-title { text-align: center; font-size: 22px; font-weight: 900; color: #b71c1c; margin-bottom: 18px; line-height: 1.5; } .mk2-gallery .slider-main { position: relative; border-radius: 18px; overflow: hidden; box-shadow: 0 20px 60px rgba(198,40,40,0.25); background: #000; aspect-ratio: 16/9; } .mk2-gallery .slide { position: absolute; inset: 0; opacity: 0; transition: opacity 0.6s ease, transform 0.6s ease; transform: scale(1.03); } .mk2-gallery .slide.active { opacity: 1; transform: scale(1); z-index: 2; } .mk2-gallery .slide img { width: 100%; height: 100%; object-fit: cover; display: block; margin: 0; padding: 0; } .mk2-gallery .counter { position: absolute; top: 14px; left: 14px; background: rgba(183,28,28,0.8); color: white; font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 30px; z-index: 10; margin: 0; } .mk2-gallery .nav-btn { position: absolute; top: 50%; transform: translateY(-50%); z-index: 10; background: rgba(255,255,255,0.95); border: none; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; font-size: 18px; color: #b71c1c; box-shadow: 0 4px 16px rgba(0,0,0,0.2); transition: background 0.2s; display: flex; align-items: center; justify-content: center; margin: 0; padding: 0; } .mk2-gallery .nav-btn:hover { background: #C62828; color: white; } .mk2-gallery .nav-prev { right: 14px; } .mk2-gallery .nav-next { left: 14px; } .mk2-gallery .thumbs { display: flex; gap: 10px; margin-top: 14px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; } .mk2-gallery .thumbs::-webkit-scrollbar { display: none; } .mk2-gallery .thumb { flex-shrink: 0; width: 80px; height: 58px; border-radius: 10px; overflow: hidden; cursor: pointer; border: 3px solid transparent; transition: all 0.2s; opacity: 0.6; margin: 0; padding: 0; } .mk2-gallery .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; margin: 0; padding: 0; } .mk2-gallery .thumb.active { border-color: #C62828; opacity: 1; transform: translateY(-3px); box-shadow: 0 6px 18px rgba(198,40,40,0.35); } .mk2-gallery .dots { display: flex; justify-content: center; gap: 7px; margin-top: 14px; flex-wrap: wrap; padding: 0; } .mk2-gallery .dot { width: 8px; height: 8px; border-radius: 50%; background: #b0bec5; cursor: pointer; transition: all 0.2s; margin: 0; padding: 0; } .mk2-gallery .dot.active { background: #C62828; transform: scale(1.4); } .mk2-gallery .progress-bar { height: 3px; background: rgba(255,255,255,0.3); position: absolute; bottom: 0; left: 0; right: 0; z-index: 10; margin: 0; padding: 0; } .mk2-gallery .progress-fill { height: 100%; background: #e53935; width: 0%; transition: width linear; margin: 0; padding: 0; } 📸 جانب من أعمالي في طريقة عرض الصور في المقالات 1 / 12 › ‹ (function(){ const slides = document.querySelectorAll('.mk2-gallery .slide'); const thumbs = document.querySelectorAll('.mk2-gallery .thumb'); const dotsContainer = document.getElementById('mk2-dots'); const counter = document.getElementById('mk2-counter'); const progress = document.getElementById('mk2-progress'); let current = 0; let autoTimer; const DELAY = 4000; slides.forEach((_, i) => { const d = document.createElement('div'); d.className = 'dot' + (i === 0 ? ' active' : ''); d.onclick = () => mk2GoTo(i); dotsContainer.appendChild(d); }); window.mk2GoTo = function(n) { slides[current].classList.remove('active'); thumbs[current].classList.remove('active'); dotsContainer.children[current].classList.remove('active'); current = (n + slides.length) % slides.length; slides[current].classList.add('active'); thumbs[current].classList.add('active'); dotsContainer.children[current].classList.add('active'); counter.textContent = (current + 1) + ' / ' + slides.length; const thumbsContainer = document.getElementById('mk2-thumbs'); const activeThumb = thumbs[current]; const containerLeft = thumbsContainer.scrollLeft; const containerWidth = thumbsContainer.offsetWidth; const thumbLeft = activeThumb.offsetLeft; const thumbWidth = activeThumb.offsetWidth; if (thumbLeft < containerLeft || thumbLeft + thumbWidth > containerLeft + containerWidth) { thumbsContainer.scrollTo({ left: thumbLeft - containerWidth / 2 + thumbWidth / 2, behavior: 'smooth' }); } resetProgress(); }; window.mk2ChangeSlide = function(dir) { mk2GoTo(current + dir); }; function resetProgress() { clearTimeout(autoTimer); progress.style.transition = 'none'; progress.style.width = '0%'; setTimeout(() => { progress.style.transition = 'width ' + DELAY + 'ms linear'; progress.style.width = '100%'; }, 50); autoTimer = setTimeout(() => mk2GoTo(current + 1), DELAY); } document.addEventListener('keydown', e => { if (e.key === 'ArrowRight') mk2ChangeSlide(-1); if (e.key === 'ArrowLeft') mk2ChangeSlide(1); }); let touchStart = 0; const sliderEl = document.getElementById('mk2-slider'); sliderEl.addEventListener('touchstart', e => touchStart = e.touches[0].clientX); sliderEl.addEventListener('touchend', e => { const diff = touchStart - e.changedTouches[0].clientX; if (Math.abs(diff) > 40) mk2ChangeSlide(diff > 0 ? 1 : -1); }); resetProgress(); })();