Travel Hero Slider Template
Preview
Edit
Download
Run
Download Options
HTML File
Download as .html file
CSS File
Download as .css file
JavaScript File
Download as .js file
Combined HTML
All code in one HTML file
Project ZIP
All files in a ZIP archive
Cancel
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Premium Travel Hero Slider</title> <!-- Google Fonts for Premium Typography --> <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;700&family=Playfair+Display:ital,wght@0,600;1,600&display=swap" rel="stylesheet"> </head> <body> <div class="hero-slider"> <!-- Slide 1 --> <div class="slide active"> <div class="slide-bg" style="background-image: url('https://images.unsplash.com/photo-1499856871958-5b9627545d1a?q=80&w=2000&auto=format&fit=crop');"></div> <div class="slide-overlay"></div> <div class="slide-content"> <div class="subtitle">Escape to Elegance</div> <h1 class="title">Parisian<br>Dreams</h1> <p class="description">Wander through cobblestone streets, indulge in world-class culinary delights, and fall in love with the city of lights.</p> <a href="#" class="btn">Book Now</a> </div> </div> <!-- Slide 2 --> <div class="slide"> <div class="slide-bg" style="background-image: url('https://images.unsplash.com/photo-1532274402911-5a369e4c4bb5?q=80&w=2000&auto=format&fit=crop');"></div> <div class="slide-overlay"></div> <div class="slide-content"> <div class="subtitle">Nature's Masterpiece</div> <h1 class="title">Swiss<br>Alps</h1> <p class="description">Breathe in the crisp mountain air and witness breathtaking panoramic views from the top of the world.</p> <a href="#" class="btn">Book Now</a> </div> </div> <!-- Slide 3 --> <div class="slide"> <div class="slide-bg" style="background-image: url('https://images.unsplash.com/photo-1516815231560-8f41ec531527?q=80&w=2000&auto=format&fit=crop');"></div> <div class="slide-overlay"></div> <div class="slide-content"> <div class="subtitle">Tropical Paradise</div> <h1 class="title">Maldives<br>Retreat</h1> <p class="description">Experience ultimate luxury in overwater villas surrounded by crystal clear turquoise waters and untouched coral reefs.</p> <a href="#" class="btn">Book Now</a> </div> </div> <!-- Navigation Arrows --> <button class="nav-btn prev-btn" id="prevBtn"> <svg viewBox="0 0 24 24"><path d="M15 19l-7-7 7-7" stroke-linecap="round" stroke-linejoin="round"/></svg> </button> <button class="nav-btn next-btn" id="nextBtn"> <svg viewBox="0 0 24 24"><path d="M9 5l7 7-7 7" stroke-linecap="round" stroke-linejoin="round"/></svg> </button> <!-- Pagination Dots --> <div class="dots-container" id="dotsContainer"> <div class="dot active" data-index="0"></div> <div class="dot" data-index="1"></div> <div class="dot" data-index="2"></div> </div> </div> </body> </html>
CSS
/* CSS Reset & Basic Setup */ * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Montserrat', sans-serif; background-color: #000; overflow-x: hidden; } /* Slider Container */ .hero-slider { position: relative; width: 100vw; height: 100vh; overflow: hidden; } /* Individual Slide */ .slide { position: absolute; top: 0; left: 0; width: 100%; height: 100%; opacity: 0; visibility: hidden; transition: opacity 1.5s ease-in-out, visibility 1.5s; z-index: 1; } .slide.active { opacity: 1; visibility: visible; z-index: 2; } /* Cinematic Background Zoom Effect */ .slide-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-size: cover; background-position: center; transform: scale(1); transition: transform 8s ease-out; /* Slow zoom */ } .slide.active .slide-bg { transform: scale(1.08); /* Cinematic slight zoom */ } /* Premium Dark Overlay */ .slide-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient( to bottom, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.6) 100% ); } /* Slide Content (Text & Button) */ .slide-content { position: absolute; top: 50%; left: 10%; transform: translateY(-50%); max-width: 800px; color: #fff; z-index: 3; } .subtitle { font-family: 'Montserrat', sans-serif; font-size: 14px; letter-spacing: 4px; text-transform: uppercase; margin-bottom: 15px; color: #d4af37; /* Subtle Gold for luxury feel */ } .title { font-family: 'Playfair Display', serif; font-size: 5rem; line-height: 1.1; margin-bottom: 25px; letter-spacing: 1px; font-weight: 600; } .description { font-size: 1.1rem; font-weight: 300; line-height: 1.6; margin-bottom: 40px; max-width: 600px; color: rgba(255, 255, 255, 0.85); } /* Premium Button */ .btn { display: inline-block; padding: 16px 40px; font-size: 14px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: #fff; text-decoration: none; border: 1px solid #fff; background: transparent; transition: all 0.4s ease; position: relative; overflow: hidden; } .btn:hover { background: #fff; color: #000; } /* Sequential Animation Setup */ .slide .subtitle, .slide .title, .slide .description, .slide .btn { opacity: 0; transform: translateY(40px); transition: opacity 1s ease, transform 1s ease; } /* Trigger Sequential Animations when active */ .slide.active .subtitle { opacity: 1; transform: translateY(0); transition-delay: 0.6s; } .slide.active .title { opacity: 1; transform: translateY(0); transition-delay: 0.9s; } .slide.active .description { opacity: 1; transform: translateY(0); transition-delay: 1.2s; } .slide.active .btn { opacity: 1; transform: translateY(0); transition-delay: 1.5s; } /* Minimal Navigation Arrows */ .nav-btn { position: absolute; top: 50%; transform: translateY(-50%); background: transparent; border: none; cursor: pointer; z-index: 10; padding: 20px; opacity: 0.5; transition: opacity 0.3s ease; } .nav-btn:hover { opacity: 1; } .prev-btn { left: 2%; } .next-btn { right: 2%; } .nav-btn svg { width: 30px; height: 30px; stroke: #fff; stroke-width: 1.5; fill: none; } /* Minimal Dots */ .dots-container { position: absolute; bottom: 5%; left: 50%; transform: translateX(-50%); display: flex; gap: 12px; z-index: 10; } .dot { width: 8px; height: 8px; background-color: rgba(255, 255, 255, 0.4); border-radius: 50%; cursor: pointer; transition: all 0.4s ease; } .dot.active { background-color: #fff; transform: scale(1.3); } /* Responsive Design */ @media (max-width: 768px) { .title { font-size: 3rem; } .slide-content { left: 5%; padding-right: 5%; } .description { font-size: 1rem; } .nav-btn { display: none; } /* Hide arrows on mobile for cleaner look */ }
JavaScript
document.addEventListener('DOMContentLoaded', () => { const slides = document.querySelectorAll('.slide'); const dots = document.querySelectorAll('.dot'); const prevBtn = document.getElementById('prevBtn'); const nextBtn = document.getElementById('nextBtn'); let currentIndex = 0; let slideInterval; const intervalTime = 7000; // 7 seconds - slow and elegant function goToSlide(index) { // Remove active class from all slides.forEach(slide => slide.classList.remove('active')); dots.forEach(dot => dot.classList.remove('active')); // Add active class to current slides[index].classList.add('active'); dots[index].classList.add('active'); currentIndex = index; } function nextSlide() { let newIndex = currentIndex + 1; if (newIndex >= slides.length) newIndex = 0; goToSlide(newIndex); } function prevSlide() { let newIndex = currentIndex - 1; if (newIndex < 0) newIndex = slides.length - 1; goToSlide(newIndex); } // Event Listeners for Arrows nextBtn.addEventListener('click', () => { nextSlide(); resetInterval(); }); prevBtn.addEventListener('click', () => { prevSlide(); resetInterval(); }); // Event Listeners for Dots dots.forEach(dot => { dot.addEventListener('click', function() { const index = parseInt(this.getAttribute('data-index')); goToSlide(index); resetInterval(); }); }); // Auto-play Slider function startInterval() { slideInterval = setInterval(nextSlide, intervalTime); } function resetInterval() { clearInterval(slideInterval); startInterval(); } // Start Auto-play startInterval(); });
Output Preview
Desktop
Mobile
Fullscreen