<div class="testimonial-container">
<div class="testimonial-header">
<h2>What Our Clients Say</h2>
<p>Don't just take our word for it - hear from our satisfied customers</p>
</div>
<div class="testimonial-carousel">
<div class="testimonial-track" id="testimonialTrack">
<!-- Testimonial 1 -->
<div class="testimonial-slide active">
<div class="testimonial-content">
<div class="quote-icon">"</div>
<p class="testimonial-text">
"This service has completely transformed our business. The team is professional, responsive, and delivers exceptional results every time."
</p>
<div class="rating">
<span class="star filled">β
</span>
<span class="star filled">β
</span>
<span class="star filled">β
</span>
<span class="star filled">β
</span>
<span class="star filled">β
</span>
</div>
<div class="client-info">
<img src="https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=80&h=80&fit=crop&crop=face" alt="Sarah Johnson" class="client-photo">
<div class="client-details">
<h4>Sarah Johnson</h4>
<p>CEO, TechStart Inc.</p>
</div>
</div>
</div>
</div>
<!-- Testimonial 2 -->
<div class="testimonial-slide">
<div class="testimonial-content">
<div class="quote-icon">"</div>
<p class="testimonial-text">
"Outstanding quality and attention to detail. They understood our vision perfectly and delivered beyond our expectations. Highly recommended!"
</p>
<div class="rating">
<span class="star filled">β
</span>
<span class="star filled">β
</span>
<span class="star filled">β
</span>
<span class="star filled">β
</span>
<span class="star filled">β
</span>
</div>
<div class="client-info">
<img src="https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=80&h=80&fit=crop&crop=face" alt="Michael Chen" class="client-photo">
<div class="client-details">
<h4>Michael Chen</h4>
<p>Founder, Creative Studio</p>
</div>
</div>
</div>
</div>
<!-- Testimonial 3 -->
<div class="testimonial-slide">
<div class="testimonial-content">
<div class="quote-icon">"</div>
<p class="testimonial-text">
"The results speak for themselves. Our conversion rate increased by 300% after working with this amazing team. Simply incredible!"
</p>
<div class="rating">
<span class="star filled">β
</span>
<span class="star filled">β
</span>
<span class="star filled">β
</span>
<span class="star filled">β
</span>
<span class="star">β
</span>
</div>
<div class="client-info">
<img src="https://images.unsplash.com/photo-1494790108755-2616b612b786?w=80&h=80&fit=crop&crop=face" alt="Emily Rodriguez" class="client-photo">
<div class="client-details">
<h4>Emily Rodriguez</h4>
<p>Marketing Director, GrowthCo</p>
</div>
</div>
</div>
</div>
<!-- Testimonial 4 -->
<div class="testimonial-slide">
<div class="testimonial-content">
<div class="quote-icon">"</div>
<p class="testimonial-text">
"Professional, reliable, and innovative. They took our project from concept to completion flawlessly. We couldn't be happier with the outcome."
</p>
<div class="rating">
<span class="star filled">β
</span>
<span class="star filled">β
</span>
<span class="star filled">β
</span>
<span class="star filled">β
</span>
<span class="star filled">β
</span>
</div>
<div class="client-info">
<img src="https://images.unsplash.com/photo-1500648767791-00dcc994a43e?w=80&h=80&fit=crop&crop=face" alt="David Thompson" class="client-photo">
<div class="client-details">
<h4>David Thompson</h4>
<p>CTO, InnovateLab</p>
</div>
</div>
</div>
</div>
</div>
<div class="carousel-controls">
<button class="control-btn prev" id="prevBtn">
<svg viewBox="0 0 24 24" fill="currentColor">
<path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/>
</svg>
</button>
<button class="control-btn next" id="nextBtn">
<svg viewBox="0 0 24 24" fill="currentColor">
<path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/>
</svg>
</button>
</div>
<div class="carousel-indicators">
<button class="indicator active" data-slide="0"></button>
<button class="indicator" data-slide="1"></button>
<button class="indicator" data-slide="2"></button>
<button class="indicator" data-slide="3"></button>
</div>
</div>
</div>
.testimonial-container {
max-width: 800px;
margin: 0 auto;
padding: 40px 20px;
background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
border-radius: 20px;
}
.testimonial-header {
text-align: center;
margin-bottom: 50px;
}
.testimonial-header h2 {
font-size: 2.5rem;
font-weight: 700;
color: #333;
margin: 0 0 15px 0;
}
.testimonial-header p {
font-size: 1.1rem;
color: #666;
margin: 0;
}
.testimonial-carousel {
position: relative;
overflow: hidden;
border-radius: 20px;
}
.testimonial-track {
display: flex;
transition: transform 0.5s ease-in-out;
}
.testimonial-slide {
min-width: 100%;
opacity: 0;
transition: opacity 0.5s ease-in-out;
}
.testimonial-slide.active {
opacity: 1;
}
.testimonial-content {
background: white;
padding: 50px 40px;
border-radius: 20px;
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
text-align: center;
position: relative;
margin: 0 10px;
}
.quote-icon {
font-size: 4rem;
color: #667eea;
font-family: serif;
line-height: 1;
margin-bottom: 20px;
opacity: 0.3;
}
.testimonial-text {
font-size: 1.2rem;
line-height: 1.8;
color: #333;
margin: 0 0 30px 0;
font-style: italic;
}
.rating {
margin-bottom: 30px;
}
.star {
font-size: 1.5rem;
color: #ddd;
margin: 0 2px;
transition: color 0.3s ease;
}
.star.filled {
color: #ffd700;
}
.client-info {
display: flex;
align-items: center;
justify-content: center;
gap: 20px;
}
.client-photo {
width: 80px;
height: 80px;
border-radius: 50%;
object-fit: cover;
border: 4px solid #667eea;
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}
.client-details {
text-align: left;
}
.client-details h4 {
font-size: 1.2rem;
font-weight: 600;
color: #333;
margin: 0 0 5px 0;
}
.client-details p {
color: #666;
margin: 0;
font-size: 0.9rem;
}
.carousel-controls {
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 100%;
display: flex;
justify-content: space-between;
padding: 0 20px;
pointer-events: none;
}
.control-btn {
width: 50px;
height: 50px;
border-radius: 50%;
border: none;
background: rgba(255, 255, 255, 0.9);
color: #667eea;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: all 0.3s ease;
pointer-events: auto;
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}
.control-btn:hover {
background: #667eea;
color: white;
transform: scale(1.1);
}
.control-btn svg {
width: 24px;
height: 24px;
}
.carousel-indicators {
display: flex;
justify-content: center;
gap: 10px;
margin-top: 30px;
}
.indicator {
width: 12px;
height: 12px;
border-radius: 50%;
border: none;
background: #ddd;
cursor: pointer;
transition: all 0.3s ease;
}
.indicator.active {
background: #667eea;
transform: scale(1.2);
}
.indicator:hover {
background: #667eea;
opacity: 0.7;
}
/* Auto-play progress indicator */
.progress-bar {
position: absolute;
bottom: 0;
left: 0;
height: 3px;
background: #667eea;
transition: width 0.1s linear;
border-radius: 0 0 20px 20px;
}
/* Responsive design */
@media (max-width: 768px) {
.testimonial-container {
padding: 30px 15px;
}
.testimonial-header h2 {
font-size: 2rem;
}
.testimonial-content {
padding: 40px 30px;
margin: 0 5px;
}
.testimonial-text {
font-size: 1.1rem;
}
.client-info {
flex-direction: column;
gap: 15px;
}
.client-details {
text-align: center;
}
.client-photo {
width: 60px;
height: 60px;
}
.carousel-controls {
padding: 0 10px;
}
.control-btn {
width: 40px;
height: 40px;
}
}
/* Animation for slide entrance */
.testimonial-slide {
animation: slideIn 0.6s ease-out;
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateY(30px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
document.addEventListener('DOMContentLoaded', function() {
const track = document.getElementById('testimonialTrack');
const slides = document.querySelectorAll('.testimonial-slide');
const prevBtn = document.getElementById('prevBtn');
const nextBtn = document.getElementById('nextBtn');
const indicators = document.querySelectorAll('.indicator');
let currentSlide = 0;
let isAutoPlaying = true;
let autoPlayInterval;
// Initialize carousel
function init() {
showSlide(0);
startAutoPlay();
}
// Show specific slide
function showSlide(index) {
// Remove active class from all slides and indicators
slides.forEach(slide => slide.classList.remove('active'));
indicators.forEach(indicator => indicator.classList.remove('active'));
// Add active class to current slide and indicator
slides[index].classList.add('active');
indicators[index].classList.add('active');
// Move track
const translateX = -index * 100;
track.style.transform = `translateX(${translateX}%)`;
currentSlide = index;
}
// Next slide
function nextSlide() {
const next = (currentSlide + 1) % slides.length;
showSlide(next);
}
// Previous slide
function prevSlide() {
const prev = (currentSlide - 1 + slides.length) % slides.length;
showSlide(prev);
}
// Auto play functionality
function startAutoPlay() {
if (isAutoPlaying) {
autoPlayInterval = setInterval(nextSlide, 5000);
}
}
function stopAutoPlay() {
clearInterval(autoPlayInterval);
isAutoPlaying = false;
}
function resumeAutoPlay() {
isAutoPlaying = true;
startAutoPlay();
}
// Event listeners
nextBtn.addEventListener('click', () => {
nextSlide();
stopAutoPlay();
setTimeout(resumeAutoPlay, 10000); // Resume after 10 seconds
});
prevBtn.addEventListener('click', () => {
prevSlide();
stopAutoPlay();
setTimeout(resumeAutoPlay, 10000);
});
// Indicator clicks
indicators.forEach((indicator, index) => {
indicator.addEventListener('click', () => {
showSlide(index);
stopAutoPlay();
setTimeout(resumeAutoPlay, 10000);
});
});
// Pause on hover
const container = document.querySelector('.testimonial-carousel');
container.addEventListener('mouseenter', stopAutoPlay);
container.addEventListener('mouseleave', resumeAutoPlay);
// Touch/swipe support for mobile
let startX = 0;
let endX = 0;
container.addEventListener('touchstart', (e) => {
startX = e.touches[0].clientX;
});
container.addEventListener('touchend', (e) => {
endX = e.changedTouches[0].clientX;
handleSwipe();
});
function handleSwipe() {
const swipeThreshold = 50;
const diff = startX - endX;
if (Math.abs(diff) > swipeThreshold) {
if (diff > 0) {
// Swipe left - next slide
nextSlide();
} else {
// Swipe right - previous slide
prevSlide();
}
stopAutoPlay();
setTimeout(resumeAutoPlay, 10000);
}
}
// Keyboard navigation
document.addEventListener('keydown', (e) => {
if (e.key === 'ArrowLeft') {
prevSlide();
stopAutoPlay();
setTimeout(resumeAutoPlay, 10000);
} else if (e.key === 'ArrowRight') {
nextSlide();
stopAutoPlay();
setTimeout(resumeAutoPlay, 10000);
}
});
// Progress bar (optional)
function createProgressBar() {
const progressBar = document.createElement('div');
progressBar.className = 'progress-bar';
container.appendChild(progressBar);
let progress = 0;
const progressInterval = setInterval(() => {
if (isAutoPlaying) {
progress += 2; // 2% every 100ms = 5 seconds total
progressBar.style.width = progress + '%';
if (progress >= 100) {
progress = 0;
}
} else {
progress = 0;
progressBar.style.width = '0%';
}
}, 100);
}
// Add smooth entrance animation
function animateSlideEntrance() {
const activeSlide = document.querySelector('.testimonial-slide.active');
const content = activeSlide.querySelector('.testimonial-content');
content.style.transform = 'translateY(20px)';
content.style.opacity = '0';
setTimeout(() => {
content.style.transition = 'all 0.6s ease';
content.style.transform = 'translateY(0)';
content.style.opacity = '1';
}, 100);
}
// Initialize everything
init();
createProgressBar();
// Add entrance animation to first slide
setTimeout(animateSlideEntrance, 500);
// Re-animate on slide change
const originalShowSlide = showSlide;
showSlide = function(index) {
originalShowSlide(index);
setTimeout(animateSlideEntrance, 100);
};
});