WEBLEB
Inicio
Editora de código
Iniciar sesión
Pro
Español
English
Français
Español
Português
Deutsch
Italiano
हिंदी
Especificaciones del coche (Acordeón) HTML
87
Metehan
Abrir en el editor
Publica tu código
Recomendado
24 February 2024
Generador de ideas HTML
31 October 2023
Código del Juego del Círculo
5 May 2024
Plantilla HTML de menú de restaurante
HTML
Copy
Document
Now in Showroom
01
BMW M3
BMW M3 Competition
Twin-Turbo Inline-6 Performance
Engine:
3.0L Twin-Turbo Inline-6
Power:
503 HP @ 6,250 RPM
Torque:
650 Nm @ 2,750 RPM
Transmission:
8-Speed Automatic
0-100: 3.9s
Top Speed: 290 km/h
Price: $73,400
02
Lamborghini Huracán
Lamborghini Huracán
Naturally Aspirated V10 Excellence
Engine:
5.2L V10 Naturally Aspirated
Power:
610 HP @ 8,250 RPM
Torque:
560 Nm @ 6,500 RPM
Transmission:
7-Speed Dual-Clutch
0-100: 3.2s
Top Speed: 325 km/h
Price: $248,295
03
Ferrari SF90
Ferrari SF90 Stradale
Plug-in Hybrid Revolution
Engine:
4.0L V8 Twin-Turbo + Electric
Power:
1000 HP Combined
Torque:
800 Nm @ 6,000 RPM
Transmission:
8-Speed F1 DCT
0-100: 2.5s
Top Speed: 340 km/h
Price: $625,000
04
Porsche 911
Porsche 911 Turbo S
Twin-Turbo Flat-Six Perfection
Engine:
3.8L Twin-Turbo Flat-6
Power:
640 HP @ 6,750 RPM
Torque:
800 Nm @ 2,500 RPM
Transmission:
8-Speed PDK
0-100: 2.7s
Top Speed: 330 km/h
Price: $207,000
‹
›
CSS
Copy
/* Copyright (c) 2025 by NIDAL (https://codepen.io/Nidal95/pen/xbwRYgV) */ * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f0f2f5; min-height: 100vh; display: flex; align-items: center; justify-content: center; } .slider-container { width: 100%; max-width: 1200px; height: 100vh; position: relative; overflow: hidden; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1); } .now-showing { position: absolute; top: 20px; left: 20px; color: #9fff6b; font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; z-index: 10; } .now-showing::before { content: ""; width: 6px; height: 6px; background: #9fff6b; border-radius: 50%; } .accordion-slider { display: flex; height: 100%; position: relative; } .slide { flex: 1; position: relative; cursor: pointer; background-size: cover; background-position: center; background-repeat: no-repeat; transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1); overflow: hidden; filter: grayscale(1); } .slide:hover { filter: grayscale(0); } .slide.active { flex: 2.5; filter: grayscale(0); } .slide::before { content: ""; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.8) 80%); } .slide-content { position: absolute; bottom: 30px; left: 30px; right: 30px; color: white; z-index: 2; } .slide.active .slide-content { bottom: 80px; transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.2s; } .slide-number { font-size: 64px; font-weight: 300; color: rgba(255, 255, 255, 0.6); line-height: 1; position: absolute; bottom: 30px; left: 30px; transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1); } .slide.active .slide-number { bottom: auto; top: -50px; font-size: 48px; left: 0; } .car-brand { font-size: 16px; font-weight: 600; color: rgba(255, 255, 255, 0.8); margin-bottom: 5px; transform: rotate(-90deg); transform-origin: left bottom; position: absolute; bottom: 100px; left: 30px; white-space: nowrap; transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1); } .slide.active .car-brand { transform: rotate(0deg); position: static; transform-origin: unset; } .car-name { font-size: 28px; font-weight: 700; margin-bottom: 8px; opacity: 0; transform: translateY(30px); transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1); transition-delay: 0s; } .slide.active .car-name { opacity: 1; transform: translateY(0); transition-delay: 0.3s; } .car-subtitle { font-size: 16px; color: rgba(255, 255, 255, 0.8); margin-bottom: 20px; opacity: 0; transform: translateY(30px); transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1); transition-delay: 0s; } .slide.active .car-subtitle { opacity: 1; transform: translateY(0); transition-delay: 0.4s; } .car-specs { opacity: 0; transform: translateY(30px); transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1); transition-delay: 0s; } .slide.active .car-specs { opacity: 1; transform: translateY(0); transition-delay: 0.5s; } .spec-row { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 14px; opacity: 0; transform: translateX(-20px); transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); } .slide.active .spec-row { opacity: 1; transform: translateX(0); } .slide.active .spec-row:nth-child(1) { transition-delay: 0.6s; } .slide.active .spec-row:nth-child(2) { transition-delay: 0.65s; } .slide.active .spec-row:nth-child(3) { transition-delay: 0.7s; } .slide.active .spec-row:nth-child(4) { transition-delay: 0.75s; } .spec-label { color: rgba(255, 255, 255, 0.7); } .spec-value { color: white; font-weight: 600; } .performance-badges { display: flex; gap: 12px; margin-top: 15px; opacity: 0; transform: translateY(30px); transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1); transition-delay: 0s; } .slide.active .performance-badges { opacity: 1; transform: translateY(0); transition-delay: 0.8s; } .badge { display: flex; align-items: center; gap: 6px; padding: 4px 8px; background: rgba(255, 255, 255, 0.1); border-radius: 12px; font-size: 12px; font-weight: 500; opacity: 0; transform: scale(0.8); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); } .slide.active .badge { opacity: 1; transform: scale(1); } .slide.active .badge:nth-child(1) { transition-delay: 0.85s; } .slide.active .badge:nth-child(2) { transition-delay: 0.9s; } .slide.active .badge:nth-child(3) { transition-delay: 0.95s; } .badge-icon { width: 8px; height: 8px; background: #9fff6b; border-radius: 50%; } .add-button { position: absolute; bottom: 30px; right: 30px; width: 32px; height: 32px; background: transparent; border: 2px solid #9fff6b; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.4s ease; z-index: 3; } .add-button::before, .add-button::after { content: ""; position: absolute; background: #9fff6b; transition: all 0.4s ease; } .add-button::before { width: 12px; height: 2px; } .add-button::after { width: 2px; height: 12px; transform: rotate(0deg); } .slide.active .add-button::before { transform: rotate(0deg); } .slide.active .add-button::after { opacity: 0; transform: scale(0); } .navigation-arrows { position: absolute; top: 50%; transform: translateY(-50%); width: 50px; height: 50px; background: rgba(255, 255, 255, 0.1); border: none; border-radius: 50%; color: white; cursor: pointer; font-size: 20px; display: flex; align-items: center; justify-content: center; transition: all 0.3s ease; z-index: 4; backdrop-filter: blur(10px); } .nav-prev { left: 20px; } .nav-next { right: 20px; } .navigation-arrows:hover { background: rgba(255, 255, 255, 0.2); } @media (max-width: 768px) { .accordion-slider { flex-direction: column; } .slide { flex: 1; min-height: 80px; } .slide.active { flex: 2; } .slide-number { font-size: 32px; } .car-brand { transform: none; position: static; } }
JS
Copy
class AccordionSlider { constructor() { this.slides = document.querySelectorAll(".slide"); this.prevBtn = document.querySelector(".nav-prev"); this.nextBtn = document.querySelector(".nav-next"); this.currentIndex = -1; this.init(); } init() { this.slides.forEach((slide, index) => { slide.addEventListener("click", () => this.setActiveSlide(index)); }); this.prevBtn.addEventListener("click", () => this.previousSlide()); this.nextBtn.addEventListener("click", () => this.nextSlide()); document.addEventListener("keydown", (e) => { if (e.key === "ArrowLeft") this.previousSlide(); if (e.key === "ArrowRight") this.nextSlide(); }); } setActiveSlide(index) { if (this.currentIndex === index) { this.slides.forEach((slide) => slide.classList.remove("active")); this.currentIndex = -1; } else { this.slides.forEach((slide) => slide.classList.remove("active")); this.slides[index].classList.add("active"); this.currentIndex = index; } } nextSlide() { const nextIndex = this.currentIndex === -1 ? 0 : (this.currentIndex + 1) % this.slides.length; this.setActiveSlide(nextIndex); } previousSlide() { const prevIndex = this.currentIndex === -1 ? this.slides.length - 1 : (this.currentIndex - 1 + this.slides.length) % this.slides.length; this.setActiveSlide(prevIndex); } } document.addEventListener("DOMContentLoaded", () => { new AccordionSlider(); });