Review Carousel
Shared by: Sidney Jam

<style>
.ghl-carousel-wrapper {
position: relative;
max-width: 600px;
width: 100%;
margin: 0 auto;
perspective: 1000px;
padding-bottom: 0.5rem; /* just a little breathing room */
}
.ghl-carousel-slide {
position: absolute;
top: 0;
left: 0;
width: 100%;
background: white;
padding: 2rem;
border-radius: 1rem;
box-shadow: 0 20px 30px rgba(0, 0, 0, 0.1);
transition: transform 0.8s ease, filter 0.5s ease, opacity 0.5s ease;
opacity: 0;
filter: blur(3px);
transform: scale(0.9) translateZ(-100px);
z-index: 0;
display: none;
}
.ghl-carousel-slide.active {
display: block;
transform: scale(1) translateZ(0);
filter: none;
opacity: 1;
position: relative;
z-index: 3;
}
.ghl-carousel-slide.left,
.ghl-carousel-slide.right {
display: block;
position: absolute;
}
.ghl-carousel-slide.left {
transform: scale(0.9) translateX(-40%) rotateY(20deg) translateZ(-80px);
opacity: 0.6;
z-index: 2;
}
.ghl-carousel-slide.right {
transform: scale(0.9) translateX(40%) rotateY(-20deg) translateZ(-80px);
opacity: 0.6;
z-index: 2;
}
.ghl-testimonial-photo {
width: 50px;
height: 50px;
border-radius: 50%;
object-fit: cover;
margin-right: 12px;
}
.ghl-testimonial-header {
display: flex;
align-items: center;
margin-top: 1rem;
}
.ghl-testimonial-name {
font-weight: bold;
color: #111827;
}
.ghl-testimonial-role {
font-size: 0.85rem;
color: #6b7280;
margin-top: 2px;
}
.ghl-testimonial-text {
font-size: 1rem;
color: #374151;
line-height: 1.5;
font-style: normal;
}
.ghl-carousel-controls {
margin-top: 0.2rem; /* << TIGHTENED SPACING HERE */
display: flex;
gap: 2rem;
align-items: center;
justify-content: center;
}
.ghl-carousel-btn {
background: none;
border: none;
font-size: 1.5rem;
color: #E6720E;
cursor: pointer;
transition: transform 0.2s ease;
}
.ghl-carousel-btn:hover {
transform: scale(1.2);
}
.ghl-carousel-dot {
width: 10px;
height: 10px;
border-radius: 50%;
background-color: #c7c7e0;
cursor: pointer;
transition: all 0.3s ease;
}
.ghl-carousel-dot.active {
background-color: #E6720E;
transform: scale(1.2);
}
@media (max-width: 640px) {
.ghl-carousel-slide.left {
transform: translateX(-20%) rotateY(15deg) scale(0.85);
}
.ghl-carousel-slide.right {
transform: translateX(20%) rotateY(-15deg) scale(0.85);
}
}
</style>
<div class="ghl-carousel-wrapper">
<div class="ghl-carousel-slide">
<p class="ghl-testimonial-text">"Some text here"</p>
<div class="ghl-testimonial-header">
<img src="https://via.placeholder.com/50" alt="client name" class="ghl-testimonial-photo">
<div>
<div class="ghl-testimonial-name">Sample Client Name</div>
<div class="ghl-testimonial-role">Client Role</div>
</div>
</div>
</div>
<div class="ghl-carousel-slide">
<p class="ghl-testimonial-text">"Sample Text here”</p>
<div class="ghl-testimonial-header">
<img src="https://via.placeholder.com/50" alt="client name" class="ghl-testimonial-photo">
<div>
<div class="ghl-testimonial-name">Client name</div>
<div class="ghl-testimonial-role">Client role</div>
</div>
</div>
</div>
<div class="ghl-carousel-slide">
<p class="ghl-testimonial-text">“Sample text here”</p>
<div class="ghl-testimonial-header">
<img src="https://via.placeholder.com/50" alt="Client name" class="ghl-testimonial-photo">
<div>
<div class="ghl-testimonial-name">Client name</div>
<div class="ghl-testimonial-role">client role</div>
</div>
</div>
</div>
</div>
<div class="ghl-carousel-controls">
<button id="ghlPrevBtn" class="ghl-carousel-btn">←</button>
<div style="display: flex; gap: 10px;">
<span class="ghl-carousel-dot"></span>
<span class="ghl-carousel-dot"></span>
<span class="ghl-carousel-dot"></span>
</div>
<button id="ghlNextBtn" class="ghl-carousel-btn">→</button>
</div>
<script>
const ghlSlides = document.querySelectorAll('.ghl-carousel-slide');
const ghlDots = document.querySelectorAll('.ghl-carousel-dot');
const ghlPrevBtn = document.getElementById('ghlPrevBtn');
const ghlNextBtn = document.getElementById('ghlNextBtn');
let ghlCurrent = 0;
function updateGhlCarousel() {
ghlSlides.forEach((slide, index) => {
slide.classList.remove('active', 'left', 'right');
if (index === ghlCurrent) {
slide.classList.add('active');
} else if (index === (ghlCurrent - 1 + ghlSlides.length) % ghlSlides.length) {
slide.classList.add('left');
} else if (index === (ghlCurrent + 1) % ghlSlides.length) {
slide.classList.add('right');
}
});
ghlDots.forEach((dot, index) => {
dot.classList.toggle('active', index === ghlCurrent);
});
}
ghlPrevBtn.addEventListener('click', () => {
ghlCurrent = (ghlCurrent - 1 + ghlSlides.length) % ghlSlides.length;
updateGhlCarousel();
});
ghlNextBtn.addEventListener('click', () => {
ghlCurrent = (ghlCurrent + 1) % ghlSlides.length;
updateGhlCarousel();
});
ghlDots.forEach((dot, index) => {
dot.addEventListener('click', () => {
ghlCurrent = index;
updateGhlCarousel();
});
});
updateGhlCarousel();
</script>
Instructions
Create
Code
element and paste code.Edit
Text
,Name
, andImage URL
Save
Last updated
Was this helpful?