Flow Yoga 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>Serene Flow Yoga | Health Benefits</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=Playfair+Display:wght@400;500;600;700&family=Inter:wght@300;350;400;450;500&display=swap" rel="stylesheet"> </head> <body> <div class="container"> <header> <div class="logo">Serene Flow</div> <div class="subtitle">Yoga Health Benefits</div> </header> <div class="slider-container"> <div class="slider"> <!-- Slide 1: Stress Relief --> <div class="slide active"> <div class="slide-content"> <div class="image-container"> <img src="https://images.unsplash.com/photo-1599901860904-17e6ed7083a0?ixlib=rb-4.0.3&auto=format&fit=crop&w=1470&q=80" alt="Yoga practitioner in meditation pose for stress relief"> </div> <div class="text-container"> <div class="benefit-indicator"> <div class="benefit-number">Stress Relief</div> <div class="indicator-line"></div> </div> <h2 class="benefit-title">Cultivate Calm & Mental Clarity</h2> <p class="benefit-description"> Through mindful breathing and meditation, yoga reduces cortisol levels by up to 30%, calms the nervous system, and enhances emotional regulation. Experience increased focus and a profound sense of inner peace. </p> <a href="#stress-relief" class="cta-button"> Explore Calming Practices <span class="cta-icon"><i class="fas fa-arrow-right"></i></span> </a> </div> </div> </div> <!-- Slide 2: Posture Improvement --> <div class="slide"> <div class="slide-content"> <div class="image-container"> <img src="https://images.unsplash.com/photo-1544367567-0f2fcb009e0b?ixlib=rb-4.0.3&auto=format&fit=crop&w=1520&q=85" alt="Yoga practitioner demonstrating proper spinal alignment"> </div> <div class="text-container"> <div class="benefit-indicator"> <div class="benefit-number">Posture & Alignment</div> <div class="indicator-line"></div> </div> <h2 class="benefit-title">Elevate Your Posture & Spinal Health</h2> <p class="benefit-description"> Yoga strengthens core stabilizers, increases spinal awareness, and corrects muscular imbalances that lead to poor posture. Transform your daily movement with improved alignment and reduced back tension. </p> <a href="#posture-improvement" class="cta-button"> Discover Alignment Techniques <span class="cta-icon"><i class="fas fa-arrow-right"></i></span> </a> </div> </div> </div> <!-- Slide 3: Flexibility --> <div class="slide"> <div class="slide-content"> <div class="image-container"> <img src="https://images.unsplash.com/photo-1545389336-cf0900438bf4?ixlib=rb-4.0.3&auto=format&fit=crop&w=1374&q=85" alt="Yoga practitioner demonstrating flexibility in a deep stretch"> </div> <div class="text-container"> <div class="benefit-indicator"> <div class="benefit-number">Flexibility & Mobility</div> <div class="indicator-line"></div> </div> <h2 class="benefit-title">Unlock Natural Movement & Grace</h2> <p class="benefit-description"> Through intelligent sequencing and consistent practice, yoga safely increases your range of motion, reduces stiffness, and enhances joint health. Move with greater ease and prevent injury at any age. </p> <a href="#flexibility" class="cta-button"> Begin Flexibility Journey <span class="cta-icon"><i class="fas fa-arrow-right"></i></span> </a> </div> </div> </div> </div> <!-- Progress bar --> <div class="progress-bar"> <div class="progress-fill" id="progress-fill"></div> </div> <!-- Slide counter --> <div class="slide-counter"> <span id="current-slide">01</span> / <span id="total-slides">03</span> </div> <!-- Navigation arrows --> <div class="nav-arrow arrow-left" id="prev-btn"> <i class="fas fa-chevron-left"></i> </div> <div class="nav-arrow arrow-right" id="next-btn"> <i class="fas fa-chevron-right"></i> </div> <!-- Navigation dots --> <div class="slider-nav"> <div class="nav-dot active" data-index="0"></div> <div class="nav-dot" data-index="1"></div> <div class="nav-dot" data-index="2"></div> </div> </div> <footer> <div class="footer-content"> <div class="copyright"> © 2023 Serene Flow Yoga. All rights reserved. </div> <div class="footer-links"> <a href="#privacy">Privacy Policy</a> <a href="#terms">Terms of Service</a> <a href="#contact">Contact Us</a> </div> </div> </footer> </div> </body> </html>
CSS
:root { --primary-dark: #1a3c2e; --primary-medium: #2d5d46; --primary-light: #4a7c5c; --accent-light: #8fb9aa; --accent-lighter: #c6e1d5; --text-dark: #1c2321; --text-medium: #4a5c54; --text-light: #7a8c84; --bg-light: #f8fbf9; --bg-lighter: #ffffff; --transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.05); --shadow-subtle: 0 8px 30px rgba(0, 0, 0, 0.04); --shadow-medium: 0 15px 40px rgba(0, 0, 0, 0.08); --border-radius: 24px; } * { margin: 0; padding: 0; box-sizing: border-box; } body { font-family: 'Inter', sans-serif; background: linear-gradient(135deg, #f8fbf9 0%, #f0f6f3 100%); color: var(--text-medium); line-height: 1.7; min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; font-weight: 350; } .container { max-width: 1400px; width: 100%; margin: 0 auto; padding: 20px; } /* Header with improved typography */ header { text-align: center; margin-bottom: 50px; position: relative; } .logo { font-family: 'Playfair Display', serif; font-size: 3.2rem; font-weight: 700; color: var(--primary-dark); margin-bottom: 8px; letter-spacing: -0.5px; position: relative; display: inline-block; } .logo::after { content: ''; position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%); width: 180px; height: 4px; background: linear-gradient(90deg, transparent, var(--accent-light), transparent); border-radius: 2px; } .subtitle { font-size: 1.1rem; color: var(--text-light); font-weight: 400; letter-spacing: 3px; text-transform: uppercase; margin-top: 20px; } /* Enhanced slider container */ .slider-container { position: relative; width: 100%; height: 640px; overflow: hidden; border-radius: var(--border-radius); box-shadow: var(--shadow-medium); background-color: var(--bg-lighter); transition: var(--transition); } .slider-container:hover { box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1); } .slider { display: flex; height: 100%; transition: transform 0.8s cubic-bezier(0.19, 1, 0.22, 1); will-change: transform; } .slide { min-width: 100%; height: 100%; display: flex; overflow: hidden; position: relative; } /* Enhanced slide content with overlay effect */ .slide-content { display: flex; width: 100%; height: 100%; position: relative; } .image-container { flex: 1.1; overflow: hidden; position: relative; } .image-container::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.95) 100%); z-index: 1; pointer-events: none; } .image-container img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s cubic-bezier(0.19, 1, 0.22, 1); will-change: transform; } .slide:hover .image-container img { transform: scale(1.05); } .text-container { flex: 0.9; padding: 70px 60px; display: flex; flex-direction: column; justify-content: center; background-color: var(--bg-lighter); z-index: 2; } /* Benefit indicator with animated line */ .benefit-indicator { display: flex; align-items: center; margin-bottom: 25px; } .benefit-number { font-size: 0.95rem; color: var(--primary-light); font-weight: 500; letter-spacing: 4px; margin-right: 20px; text-transform: uppercase; } .indicator-line { height: 1px; width: 60px; background-color: var(--accent-lighter); position: relative; overflow: hidden; } .indicator-line::after { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: var(--primary-medium); transform: translateX(-100%); transition: transform 0.8s 0.3s ease-out; } .slide.active .indicator-line::after { transform: translateX(0); } /* Enhanced title and description */ .benefit-title { font-family: 'Playfair Display', serif; font-size: 3.2rem; color: var(--primary-dark); margin-bottom: 30px; line-height: 1.15; letter-spacing: -0.5px; } .benefit-description { font-size: 1.18rem; color: var(--text-medium); margin-bottom: 50px; max-width: 520px; font-weight: 350; opacity: 0.9; } /* Premium CTA button */ .cta-button { display: inline-flex; align-items: center; padding: 18px 42px; background: linear-gradient(135deg, var(--primary-medium) 0%, var(--primary-light) 100%); color: white; text-decoration: none; border-radius: 50px; font-weight: 450; font-size: 1.05rem; letter-spacing: 1.2px; transition: var(--transition); border: none; align-self: flex-start; text-transform: uppercase; overflow: hidden; position: relative; z-index: 1; box-shadow: 0 10px 20px rgba(45, 93, 70, 0.15); } .cta-button::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-medium) 100%); z-index: -1; opacity: 0; transition: opacity 0.4s ease; } .cta-button:hover { transform: translateY(-5px); box-shadow: 0 15px 30px rgba(45, 93, 70, 0.25); } .cta-button:hover::before { opacity: 1; } .cta-icon { margin-left: 12px; transition: transform 0.3s ease; font-size: 0.9rem; } .cta-button:hover .cta-icon { transform: translateX(5px); } /* Enhanced navigation arrows */ .nav-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 68px; height: 68px; background-color: var(--bg-lighter); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: var(--primary-medium); cursor: pointer; transition: var(--transition); z-index: 10; box-shadow: var(--shadow-subtle); border: 1px solid rgba(142, 185, 170, 0.15); } .nav-arrow::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; border-radius: 50%; background-color: var(--primary-dark); opacity: 0; transition: opacity 0.3s ease; z-index: -1; } .nav-arrow:hover { color: white; transform: translateY(-50%) scale(1.08); box-shadow: 0 15px 30px rgba(0, 0, 0, 0.12); } .nav-arrow:hover::before { opacity: 1; } .arrow-left { left: 40px; } .arrow-right { right: 40px; } /* Elegant navigation dots */ .slider-nav { position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%); display: flex; gap: 14px; z-index: 10; background-color: rgba(255, 255, 255, 0.7); backdrop-filter: blur(10px); padding: 14px 24px; border-radius: 50px; box-shadow: 0 5px 20px rgba(0, 0, 0, 0.05); border: 1px solid rgba(142, 185, 170, 0.2); } .nav-dot { width: 10px; height: 10px; border-radius: 50%; background-color: var(--accent-lighter); cursor: pointer; transition: var(--transition); position: relative; } .nav-dot::before { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0); width: 24px; height: 24px; border-radius: 50%; background-color: rgba(142, 185, 170, 0.2); transition: transform 0.3s ease; } .nav-dot:hover::before { transform: translate(-50%, -50%) scale(1); } .nav-dot.active { background-color: var(--primary-medium); transform: scale(1.3); } /* Benefit counter */ .slide-counter { position: absolute; top: 40px; right: 40px; z-index: 10; background-color: rgba(255, 255, 255, 0.85); backdrop-filter: blur(10px); padding: 8px 20px; border-radius: 50px; font-size: 0.9rem; color: var(--primary-medium); font-weight: 500; letter-spacing: 1px; box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05); border: 1px solid rgba(142, 185, 170, 0.2); } /* Footer */ footer { margin-top: 50px; text-align: center; color: var(--text-light); font-size: 0.9rem; padding: 20px; width: 100%; } .footer-content { display: flex; justify-content: space-between; align-items: center; max-width: 1200px; margin: 0 auto; padding-top: 20px; border-top: 1px solid rgba(142, 185, 170, 0.3); } .footer-links { display: flex; gap: 30px; } .footer-links a { color: var(--text-light); text-decoration: none; transition: color 0.3s ease; font-size: 0.9rem; } .footer-links a:hover { color: var(--primary-medium); } /* Progress bar */ .progress-bar { position: absolute; bottom: 0; left: 0; height: 4px; width: 100%; background-color: rgba(142, 185, 170, 0.2); z-index: 10; overflow: hidden; } .progress-fill { height: 100%; width: 33.33%; background-color: var(--primary-medium); transition: transform 0.8s cubic-bezier(0.19, 1, 0.22, 1); transform: translateX(0); } /* Responsive adjustments */ @media (max-width: 1200px) { .slider-container { height: 600px; } .text-container { padding: 50px 40px; } .benefit-title { font-size: 2.8rem; } } @media (max-width: 992px) { .slide-content { flex-direction: column; } .image-container { height: 45%; } .image-container::before { background: linear-gradient(0deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0) 30%); } .text-container { height: 55%; padding: 40px; } .slider-container { height: 750px; } .benefit-title { font-size: 2.5rem; } .nav-arrow { width: 56px; height: 56px; font-size: 1.2rem; } .arrow-left { left: 20px; } .arrow-right { right: 20px; } } @media (max-width: 768px) { .logo { font-size: 2.5rem; } .slider-container { height: 700px; } .text-container { padding: 35px 30px; } .benefit-title { font-size: 2.2rem; } .benefit-description { font-size: 1.05rem; } .cta-button { padding: 16px 36px; font-size: 1rem; } .footer-content { flex-direction: column; gap: 20px; text-align: center; } } @media (max-width: 576px) { .slider-container { height: 650px; } .text-container { padding: 30px 25px; } .benefit-title { font-size: 1.9rem; } .nav-arrow { width: 48px; height: 48px; font-size: 1rem; } .slide-counter { top: 20px; right: 20px; } .slider-nav { padding: 10px 18px; } }
JavaScript
document.addEventListener('DOMContentLoaded', function() { const slider = document.querySelector('.slider'); const slides = document.querySelectorAll('.slide'); const dots = document.querySelectorAll('.nav-dot'); const prevBtn = document.getElementById('prev-btn'); const nextBtn = document.getElementById('next-btn'); const progressFill = document.getElementById('progress-fill'); const currentSlideEl = document.getElementById('current-slide'); const totalSlidesEl = document.getElementById('total-slides'); const totalSlides = slides.length; let currentSlide = 0; let slideInterval; let autoSlideDelay = 6000; // Initialize slider function initSlider() { updateSlider(); startAutoSlide(); totalSlidesEl.textContent = String(totalSlides).padStart(2, '0'); } // Go to specific slide function goToSlide(index) { // Remove active class from all slides slides.forEach(slide => slide.classList.remove('active')); currentSlide = (index + totalSlides) % totalSlides; updateSlider(); // Add active class to current slide slides[currentSlide].classList.add('active'); resetAutoSlide(); } // Update slider position and active dot function updateSlider() { slider.style.transform = `translateX(-${currentSlide * 100}%)`; // Update active dot dots.forEach((dot, index) => { if (index === currentSlide) { dot.classList.add('active'); } else { dot.classList.remove('active'); } }); // Update progress bar progressFill.style.transform = `translateX(${currentSlide * 100}%)`; // Update slide counter currentSlideEl.textContent = String(currentSlide + 1).padStart(2, '0'); } // Next slide function nextSlide() { goToSlide(currentSlide + 1); } // Previous slide function prevSlide() { goToSlide(currentSlide - 1); } // Auto slide functionality function startAutoSlide() { slideInterval = setInterval(nextSlide, autoSlideDelay); } function resetAutoSlide() { clearInterval(slideInterval); startAutoSlide(); } // Event listeners prevBtn.addEventListener('click', function(e) { e.preventDefault(); prevSlide(); }); nextBtn.addEventListener('click', function(e) { e.preventDefault(); nextSlide(); }); // Dot navigation dots.forEach(dot => { dot.addEventListener('click', function() { const slideIndex = parseInt(this.getAttribute('data-index')); goToSlide(slideIndex); }); }); // Pause auto-slide on hover const sliderContainer = document.querySelector('.slider-container'); sliderContainer.addEventListener('mouseenter', function() { clearInterval(slideInterval); }); sliderContainer.addEventListener('mouseleave', function() { startAutoSlide(); }); // Keyboard navigation document.addEventListener('keydown', function(e) { if (e.key === 'ArrowLeft') { prevSlide(); } else if (e.key === 'ArrowRight') { nextSlide(); } }); // Touch/swipe support for mobile let touchStartX = 0; let touchEndX = 0; sliderContainer.addEventListener('touchstart', function(e) { touchStartX = e.changedTouches[0].screenX; }, false); sliderContainer.addEventListener('touchend', function(e) { touchEndX = e.changedTouches[0].screenX; handleSwipe(); }, false); function handleSwipe() { const swipeThreshold = 50; if (touchEndX < touchStartX - swipeThreshold) { // Swipe left nextSlide(); } if (touchEndX > touchStartX + swipeThreshold) { // Swipe right prevSlide(); } } // Initialize the slider initSlider(); // Add a subtle parallax effect on scroll (if page is longer) window.addEventListener('scroll', function() { const scrolled = window.pageYOffset; const rate = scrolled * -0.5; sliderContainer.style.transform = `translateY(${rate}px)`; }); });
Output Preview
Desktop
Mobile
Fullscreen