Valvate Image 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 Valvate Slider</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> <link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap" rel="stylesheet"> </head> <body> <div class="parallax-bg"> <span style="left: 25%; width: 80px; height: 80px;"></span> <span style="left: 10%; width: 60px; height: 60px; animation-delay: 2s;"></span> <span style="left: 70%; width: 100px; height: 100px; animation-delay: 4s;"></span> <span style="left: 40%; width: 120px; height: 120px; animation-delay: 6s;"></span> <span style="left: 65%; width: 70px; height: 70px; animation-delay: 8s;"></span> <span style="left: 15%; width: 90px; height: 90px; animation-delay: 10s;"></span> <span style="left: 50%; width: 50px; height: 50px; animation-delay: 12s;"></span> </div> <div class="slider-container"> <div class="slider-track"> <div class="slide active"> <div class="glow-effect" style="top: 20%; left: 30%;"></div> <img src="https://plus.unsplash.com/premium_photo-1673697239981-389164b7b87f?q=80&w=844&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" alt="Luxury Resort"> <div class="slide-number">01</div> <div class="slide-content"> <h2 class="slide-title">Exclusive Retreats</h2> <p class="slide-description">Discover world-class luxury resorts that redefine hospitality with unparalleled service and breathtaking locations.</p> <a href="#" class="slide-btn">Explore Now</a> </div> </div> <div class="slide"> <div class="glow-effect" style="top: 60%; left: 70%;"></div> <img src="https://images.unsplash.com/photo-1506744038136-46273834b3fb?q=80&w=870&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" alt="Adventure"> <div class="slide-number">02</div> <div class="slide-content"> <h2 class="slide-title">Epic Adventures</h2> <p class="slide-description">Embark on thrilling journeys to the world's most spectacular natural wonders and challenging terrains.</p> <a href="#" class="slide-btn">Start Adventure</a> </div> </div> <div class="slide"> <div class="glow-effect" style="top: 40%; left: 50%;"></div> <img src="https://plus.unsplash.com/premium_photo-1666863909125-3a01f038e71f?q=80&w=786&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" alt="Urban Architecture"> <div class="slide-number">03</div> <div class="slide-content"> <h2 class="slide-title">Urban Explorations</h2> <p class="slide-description">Experience the pulse of vibrant cities with cutting-edge architecture and dynamic cultural scenes.</p> <a href="#" class="slide-btn">Discover Cities</a> </div> </div> <div class="slide"> <div class="glow-effect" style="top: 70%; left: 20%;"></div> <img src="https://plus.unsplash.com/premium_photo-1673697239984-b089baf7b6e6?q=80&w=870&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" alt="Beach Paradise"> <div class="slide-number">04</div> <div class="slide-content"> <h2 class="slide-title">Tropical Paradises</h2> <p class="slide-description">Unwind in pristine beach destinations with crystal-clear waters and powder-soft sands.</p> <a href="#" class="slide-btn">Find Your Paradise</a> </div> </div> </div> <div class="slider-controls"> <button class="slider-btn prev-btn"><i class="fas fa-chevron-left"></i></button> <button class="slider-btn next-btn"><i class="fas fa-chevron-right"></i></button> </div> <div class="slider-dots"> <div class="dot active" data-index="0"></div> <div class="dot" data-index="1"></div> <div class="dot" data-index="2"></div> <div class="dot" data-index="3"></div> </div> </div> </body> </html>
CSS
:root { --valvate-primary: #6a0dad; --valvate-secondary: #4b0082; --valvate-accent: #9370db; --valvate-light: #e6e6fa; --valvate-dark: #301934; --valvate-glow: rgba(147, 112, 219, 0.6); } * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Montserrat', sans-serif; background-color: #0a0a12; display: flex; justify-content: center; align-items: center; min-height: 100vh; overflow-x: hidden; } .slider-container { position: relative; width: 90%; max-width: 1400px; margin: 4rem auto; perspective: 2000px; } .slider-track { display: flex; transition: transform 1s cubic-bezier(0.77, 0, 0.175, 1); height: 70vh; min-height: 500px; transform-style: preserve-3d; } .slide { position: relative; min-width: 100%; height: 100%; border-radius: 20px; overflow: hidden; box-shadow: 0 30px 50px rgba(0, 0, 0, 0.3); transform-origin: center center; transition: all 0.8s cubic-bezier(0.42, 0, 0.58, 1); will-change: transform, opacity; } .slide::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(45deg, var(--valvate-dark), transparent); z-index: 1; opacity: 0.7; } .slide img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.1); transition: transform 8s cubic-bezier(0.25, 0.1, 0.25, 1); } .slide.active img { transform: scale(1); } .slide-content { position: absolute; bottom: 10%; left: 8%; z-index: 3; width: 40%; transform: translateY(50px); opacity: 0; transition: all 0.8s cubic-bezier(0.42, 0, 0.58, 1) 0.3s; } .slide.active .slide-content { transform: translateY(0); opacity: 1; } .slide-title { font-size: clamp(2rem, 4vw, 3.5rem); font-weight: 700; color: white; margin-bottom: 1.5rem; line-height: 1.2; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); position: relative; display: inline-block; } .slide-title::after { content: ''; position: absolute; bottom: -10px; left: 0; width: 70px; height: 4px; background: var(--valvate-accent); border-radius: 2px; } .slide-description { font-size: clamp(0.9rem, 1.2vw, 1.1rem); color: rgba(255, 255, 255, 0.9); line-height: 1.6; margin-bottom: 2rem; } .slide-btn { display: inline-block; padding: 12px 30px; background: var(--valvate-primary); color: white; text-decoration: none; border-radius: 30px; font-weight: 600; transition: all 0.3s ease; box-shadow: 0 5px 15px rgba(106, 13, 173, 0.4); position: relative; overflow: hidden; } .slide-btn:hover { background: var(--valvate-accent); transform: translateY(-3px); box-shadow: 0 8px 25px var(--valvate-glow); } .slide-btn::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent); transition: 0.5s; } .slide-btn:hover::before { left: 100%; } .slider-controls { position: absolute; top: 50%; width: 100%; display: flex; justify-content: space-between; transform: translateY(-50%); z-index: 10; padding: 0 2rem; } .slider-btn { background-color: rgba(20, 20, 30, 0.7); color: var(--valvate-light); border: none; width: 60px; height: 60px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); backdrop-filter: blur(10px); box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); border: 1px solid rgba(255, 255, 255, 0.1); } .slider-btn:hover { background-color: var(--valvate-primary); transform: scale(1.1) translateY(-5px); box-shadow: 0 10px 25px var(--valvate-glow); } .slider-btn i { font-size: 1.5rem; } .slider-dots { position: absolute; bottom: 5%; left: 50%; transform: translateX(-50%); display: flex; gap: 15px; z-index: 10; } .dot { width: 14px; height: 14px; border-radius: 50%; background-color: rgba(255, 255, 255, 0.3); cursor: pointer; transition: all 0.4s ease; position: relative; overflow: hidden; } .dot::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(to right, transparent, var(--valvate-accent), transparent); transition: 0.5s; } .dot.active { background-color: var(--valvate-accent); transform: scale(1.3); box-shadow: 0 0 15px var(--valvate-glow); } .dot.active::before { left: 100%; } .slide-number { position: absolute; top: 8%; right: 8%; z-index: 3; color: rgba(255, 255, 255, 0.3); font-size: 5rem; font-weight: 700; transition: all 0.5s ease; } .slide.active .slide-number { color: rgba(255, 255, 255, 0.1); transform: scale(1.2); } .parallax-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: -1; overflow: hidden; } .parallax-bg span { position: absolute; display: block; background: rgba(106, 13, 173, 0.1); border-radius: 50%; animation: float 15s linear infinite; bottom: -150px; } @keyframes float { 0% { transform: translateY(0) rotate(0deg); opacity: 1; } 100% { transform: translateY(-1000px) rotate(720deg); opacity: 0; } } /* Glow effects */ .glow-effect { position: absolute; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, var(--valvate-glow), transparent 70%); filter: blur(30px); z-index: -1; opacity: 0; transition: opacity 0.8s ease; } .slide.active .glow-effect { opacity: 0.5; } /* Responsive adjustments */ @media (max-width: 1024px) { .slider-track { height: 60vh; } .slide-content { width: 50%; } } @media (max-width: 768px) { .slider-track { height: 50vh; min-height: 400px; } .slide-content { width: 70%; left: 5%; } .slider-btn { width: 50px; height: 50px; } } @media (max-width: 576px) { .slider-container { width: 95%; } .slider-track { height: 45vh; min-height: 350px; } .slide-content { width: 85%; bottom: 5%; } .slide-title::after { width: 50px; } .slider-dots { bottom: 3%; } }
JavaScript
document.addEventListener('DOMContentLoaded', function() { const sliderTrack = document.querySelector('.slider-track'); const slides = document.querySelectorAll('.slide'); const prevBtn = document.querySelector('.prev-btn'); const nextBtn = document.querySelector('.next-btn'); const dots = document.querySelectorAll('.dot'); let currentIndex = 0; let isAnimating = false; const slideCount = slides.length; let autoplay; // Initialize slider function initSlider() { // Set initial positions updateSlider(); // Start autoplay startAutoplay(); } // Update slider position function updateSlider() { sliderTrack.style.transform = `translateX(-${currentIndex * 100}%)`; // Update active states slides.forEach((slide, index) => { slide.classList.toggle('active', index === currentIndex); }); dots.forEach((dot, index) => { dot.classList.toggle('active', index === currentIndex); }); } // Next slide with animation control function nextSlide() { if (isAnimating) return; isAnimating = true; currentIndex = (currentIndex + 1) % slideCount; updateSlider(); // Reset autoplay timer resetAutoplay(); // Enable interaction after animation setTimeout(() => { isAnimating = false; }, 1000); } // Previous slide with animation control function prevSlide() { if (isAnimating) return; isAnimating = true; currentIndex = (currentIndex - 1 + slideCount) % slideCount; updateSlider(); // Reset autoplay timer resetAutoplay(); // Enable interaction after animation setTimeout(() => { isAnimating = false; }, 1000); } // Start autoplay function startAutoplay() { autoplay = setInterval(nextSlide, 6000); } // Reset autoplay timer function resetAutoplay() { clearInterval(autoplay); startAutoplay(); } // Pause on hover sliderTrack.addEventListener('mouseenter', () => { clearInterval(autoplay); }); sliderTrack.addEventListener('mouseleave', () => { resetAutoplay(); }); // Button controls nextBtn.addEventListener('click', nextSlide); prevBtn.addEventListener('click', prevSlide); // Dot navigation dots.forEach(dot => { dot.addEventListener('click', function() { if (isAnimating) return; const targetIndex = parseInt(this.getAttribute('data-index')); if (targetIndex === currentIndex) return; isAnimating = true; currentIndex = targetIndex; updateSlider(); resetAutoplay(); setTimeout(() => { isAnimating = false; }, 1000); }); }); // Touch/swipe support with improved detection let touchStartX = 0; let touchEndX = 0; let touchStartTime = 0; sliderTrack.addEventListener('touchstart', e => { touchStartX = e.changedTouches[0].screenX; touchStartTime = Date.now(); clearInterval(autoplay); }, {passive: true}); sliderTrack.addEventListener('touchmove', e => { e.preventDefault(); // Prevent scrolling during swipe }, {passive: false}); sliderTrack.addEventListener('touchend', e => { touchEndX = e.changedTouches[0].screenX; const touchDuration = Date.now() - touchStartTime; const swipeDistance = touchEndX - touchStartX; // Only register as swipe if moved significantly and quickly if (Math.abs(swipeDistance) > 50 && touchDuration < 300) { if (swipeDistance < 0) { nextSlide(); } else { prevSlide(); } } startAutoplay(); }, {passive: true}); // Keyboard navigation document.addEventListener('keydown', e => { if (e.key === 'ArrowRight') nextSlide(); if (e.key === 'ArrowLeft') prevSlide(); }); // Parallax effect on mouse move document.addEventListener('mousemove', (e) => { const x = e.clientX / window.innerWidth; const y = e.clientY / window.innerHeight; slides.forEach(slide => { const img = slide.querySelector('img'); if (img) { img.style.transform = `scale(1.1) translate(${x * 20}px, ${y * 20}px)`; } }); }); // Initialize the slider initSlider(); });
Output Preview
Desktop
Mobile
Fullscreen