Accès au catalogue :
Catégories > survolez la catégorie, l’ID apparaît dans l’URL ex: tag_ID=5) 2. Remplacez VOTRE_SITE.com par votre domaine WordPress 3. Ajustez NB_ARTICLES si besoin (max 100) 4. Ajustez VITESSE_MS (millisecondes entre chaque slide) ============================================================ –> @import url(‘https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Lato:wght@300;400;700&display=swap’); .wp-banner-slider { position: relative; width: 100%; max-width: 100%; overflow: hidden; border-radius: 10px; background: #111; font-family: ‘Lato’, sans-serif; box-shadow: 0 8px 32px rgba(0,0,0,0.25); aspect-ratio: 32/5; min-height: 90px; } .wp-banner-track { display: flex; width: 100%; height: 100%; transition: transform 0.7s cubic-bezier(0.77, 0, 0.175, 1); } .wp-banner-slide { min-width: 100%; height: 100%; position: relative; overflow: hidden; cursor: pointer; text-decoration: none; display: block; flex-shrink: 0; } .wp-banner-slide img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 6s ease; } .wp-banner-slide:hover img { transform: scale(1.04); } /* Dégradé sombre en bas */ .wp-banner-slide::after { content: »; position: absolute; inset: 0; background: linear-gradient( to bottom, transparent 30%, rgba(0,0,0,0.3) 60%, rgba(0,0,0,0.82) 100% ); } .wp-banner-caption { position: absolute; bottom: 0; left: 0; right: 0; padding: 18px 24px 20px; z-index: 2; } .wp-banner-label { display: inline-block; background: #e63946; color: #fff; font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; padding: 3px 10px; border-radius: 3px; margin-bottom: 8px; } .wp-banner-title { font-family: ‘Bebas Neue’, sans-serif; color: #ffffff; font-size: clamp(18px, 3.5vw, 32px); line-height: 1.15; margin: 0; text-shadow: 0 2px 8px rgba(0,0,0,0.5); letter-spacing: 0.5px; } /* Boutons nav */ .wp-banner-prev, .wp-banner-next { position: absolute; top: 50%; transform: translateY(-50%); z-index: 10; background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); color: #fff; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 16px; backdrop-filter: blur(4px); transition: background 0.2s; } .wp-banner-prev:hover, .wp-banner-next:hover { background: rgba(255,255,255,0.35); } .wp-banner-prev { left: 12px; } .wp-banner-next { right: 12px; } /* Indicateurs (dots) */ .wp-banner-dots { position: absolute; bottom: 10px; right: 16px; display: flex; gap: 6px; z-index: 10; } .wp-banner-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,0.4); cursor: pointer; transition: background 0.3s, transform 0.3s; border: none; padding: 0; } .wp-banner-dot.active { background: #fff; transform: scale(1.3); } /* Barre de progression */ .wp-banner-progress { position: absolute; bottom: 0; left: 0; height: 3px; background: #e63946; width: 0%; z-index: 10; transition: none; } /* Placeholder chargement */ .wp-banner-loading { display: flex; align-items: center; justify-content: center; color: #666; font-size: 14px; height: 100%; background: #1a1a1a; } .wp-banner-no-image { width: 100%; height: 100%; background: linear-gradient(135deg, #1a1a2e, #16213e); display: flex; align-items: center; justify-content: center; font-size: 48px; } (function() { /* ══════════════════════════════════════════ ⚙️ CONFIGURATION — À MODIFIER ══════════════════════════════════════════ */ var CONFIG = { siteUrl : », // Laisser vide = site actuel. Sinon : ‘https://monsite.com’ categoryId : 79, // ← ID de la catégorie WordPress nbArticles : 8, // Nombre d’articles à afficher (max 100) vitesseMs : 5000, // Délai entre chaque slide en ms (4000 = 4 secondes) labelTexte : ‘À la une’, // Texte du badge rouge (ou » pour masquer) lienArticle: true // true = clic ouvre l’article }; /* ════════════════════════════════════════ */ var track = document.getElementById(‘wpBannerTrack’); var dotsEl = document.getElementById(‘wpBannerDots’); var prevBtn = document.getElementById(‘wpBannerPrev’); var nextBtn = document.getElementById(‘wpBannerNext’); var progress = document.getElementById(‘wpBannerProgress’); var slides = []; var current = 0; var timer = null; // Détermination de l’URL de base var base = CONFIG.siteUrl || (window.location.protocol + ‘//’ + window.location.host); var apiUrl = base + ‘/wp-json/wp/v2/posts’ + ‘?categories=’ + CONFIG.categoryId + ‘&per_page=’ + CONFIG.nbArticles + ‘&_embed=1’ + ‘&_fields=id,title,link,_embedded,_links’; // ── Fetch articles fetch(apiUrl) .then(function(r) { if (!r.ok) throw new Error(‘Erreur API: ‘ + r.status); return r.json(); }) .then(function(posts) { if (!posts || posts.length === 0) { track.innerHTML = ‘‘; return; } buildSlider(posts); }) .catch(function(err) { track.innerHTML = ‘‘; console.error(‘WP Banner:’, err); }); // ── Construction du slider function buildSlider(posts) { track.innerHTML = »; dotsEl.innerHTML = »; slides = []; posts.forEach(function(post, i) { // Image mise en avant var imgUrl = »; try { imgUrl = post._embedded[‘wp:featuredmedia’][0].source_url; } catch(e) { imgUrl = »; } var title = post.title.rendered.replace(/]+>/g, »); var link = CONFIG.lienArticle ? post.link : ‘#’; // Slide var slide = document.createElement(‘a’); slide.className = ‘wp-banner-slide’; slide.href = link; if (CONFIG.lienArticle) slide.setAttribute(‘target’, ‘_self’); if (imgUrl) { var img = document.createElement(‘img’); img.src = imgUrl; img.alt = title; img.loading = i === 0 ? ‘eager’ : ‘lazy’; slide.appendChild(img); } else { var placeholder = document.createElement(‘div’); placeholder.className = ‘wp-banner-no-image’; placeholder.textContent = ‘📰’; slide.appendChild(placeholder); } var caption = document.createElement(‘div’); caption.className = ‘wp-banner-caption’; if (CONFIG.labelTexte) { var label = document.createElement(‘div’); label.className = ‘wp-banner-label’; label.textContent = CONFIG.labelTexte; caption.appendChild(label); } var titleEl = document.createElement(‘p’); titleEl.className = ‘wp-banner-title’; titleEl.textContent = title; caption.appendChild(titleEl); slide.appendChild(caption); track.appendChild(slide); slides.push(slide); // Dot var dot = document.createElement(‘button’); dot.className = ‘wp-banner-dot’ + (i === 0 ? ‘ active’ : »); dot.setAttribute(‘aria-label’, ‘Slide ‘ + (i+1)); dot.addEventListener(‘click’, function() { goTo(i); resetTimer(); }); dotsEl.appendChild(dot); }); prevBtn.style.display = ‘flex’; nextBtn.style.display = ‘flex’; prevBtn.addEventListener(‘click’, function() { goTo(current – 1); resetTimer(); }); nextBtn.addEventListener(‘click’, function() { goTo(current + 1); resetTimer(); }); goTo(0); startTimer(); // Pause au hover document.getElementById(‘wpBannerSlider’).addEventListener(‘mouseenter’, function() { clearInterval(timer); stopProgress(); }); document.getElementById(‘wpBannerSlider’).addEventListener(‘mouseleave’, function() { startTimer(); }); } function goTo(index) { var count = slides.length; current = (index + count) % count; track.style.transform = ‘translateX(-‘ + (current * 100) + ‘%)’; // Mise à jour des dots var dots = dotsEl.querySelectorAll(‘.wp-banner-dot’); dots.forEach(function(d, i) { d.classList.toggle(‘active’, i === current); }); } function startTimer() { animateProgress(); timer = setInterval(function() { goTo(current + 1); animateProgress(); }, CONFIG.vitesseMs); } function resetTimer() { clearInterval(timer); stopProgress(); startTimer(); } function animateProgress() { stopProgress(); progress.style.transition = ‘none’; progress.style.width = ‘0%’; requestAnimationFrame(function() { requestAnimationFrame(function() { progress.style.transition = ‘width ‘ + CONFIG.vitesseMs + ‘ms linear’; progress.style.width = ‘100%’; }); }); } function stopProgress() { progress.style.transition = ‘none’; progress.style.width = ‘0%’; } })();Votre article :
Opportunité
Vous travaillez sur un seul écran ? Doublez votre espace de travail !
Moniteur 24" d’occasion en parfait état — idéal pour une configuration double écran à petit prix.
Caractéristiques
- 📐 24" — 61 cm diagonale
- 💻 LCD rétroéclairage LED
- 📊 1920 × 1080 — 16:9 Full HD
- ⚡ Dalle TFT — 2 ms
- 🔌 HDMI + D-Sub (VGA)
- ✨ Technologie Flicker-Free
- 🔧 Réglage inclinaison
Modèle
BenQ GL2450H
Prix
CHF 30.–
Sans câble HDMI
Vous avez un portable avec connecteur HDMI ?
Envie de tester avant d’acheter ? C’est possible ! Contactez-moi pour convenir d’un essai. Je suis disponible et réactif.
Contact
