What Our Clients Say
Real reviews from real customers
/* ===== Reviews Carousel Styles ===== */
#reviews-section {
font-family: -apple-system, 'Segoe UI', sans-serif;
}
.rv-carousel-wrap {
position: relative !important;
max-width: 1200px;
margin: 0 auto;
padding: 0 60px;
display: flex;
align-items: center;
min-height: 260px;
}
.rv-viewport {
overflow: hidden;
width: 100%;
flex: 1;
}
.rv-track {
display: flex;
gap: 24px;
transition: transform 0.6s cubic-bezier(0.25, 0.8, 0.25, 1);
will-change: transform;
}
.rv-card {
flex: 0 0 calc((100% - 48px) / 3);
background: #fff;
padding: 28px 24px;
border-radius: 16px;
box-shadow: 0 6px 24px rgba(0,0,0,0.06);
box-sizing: border-box;
display: flex;
flex-direction: column;
user-select: none;
}
.rv-stars {
color: #f5a623;
font-size: 18px;
margin-bottom: 12px;
letter-spacing: 2px;
}
.rv-title {
font-size: 16px;
font-weight: 600;
color: #1a1a1a;
margin: 0 0 10px 0;
}
.rv-message {
font-size: 14px;
line-height: 1.65;
color: #555;
margin: 0 0 18px 0;
flex: 1;
}
.rv-author {
display: flex;
align-items: center;
gap: 12px;
border-top: 1px solid #f0ede8;
padding-top: 16px;
}
.rv-avatar {
width: 40px;
height: 40px;
border-radius: 50%;
background: #b8956a;
color: #fff;
display: flex;
align-items: center;
justify-content: center;
font-weight: 600;
font-size: 15px;
flex-shrink: 0;
}
.rv-name {
font-size: 14px;
font-weight: 600;
color: #1a1a1a;
}
.rv-city {
font-size: 12px;
color: #999;
margin-top: 2px;
}
/* ===== Arrow Buttons — Perfectly Centered ===== */
.rv-arrow {
position: absolute !important;
top: 50% !important;
transform: translateY(-50%) !important;
width: 44px;
height: 44px;
border-radius: 50%;
background: #fff;
border: 1px solid #e8e4dd;
color: #1a1a1a;
font-size: 24px;
font-weight: 300;
line-height: 1;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 4px 14px rgba(0,0,0,0.08);
transition: all 0.25s;
z-index: 5;
padding: 0 0 3px 0;
}
.rv-arrow:hover {
background: #1a1a1a;
color: #fff;
border-color: #1a1a1a;
}
.rv-prev { left: 0 !important; }
.rv-next { right: 0 !important; }
/* Dots */
.rv-dots {
display: flex;
justify-content: center;
gap: 10px;
margin-top: 28px;
flex-wrap: wrap;
}
.rv-dot {
width: 8px;
height: 8px;
border-radius: 50%;
background: #d5d0c8;
border: none;
cursor: pointer;
padding: 0;
transition: all 0.3s;
}
.rv-dot.active {
background: #b8956a;
width: 26px;
border-radius: 4px;
}
/* ===== CTA Buttons ===== */
.rv-cta-buttons {
display: flex;
justify-content: center;
gap: 12px;
margin-top: 32px;
flex-wrap: wrap;
}
.rv-btn {
display: inline-block;
padding: 14px 26px;
border-radius: 10px;
font-weight: 600;
font-size: 14px;
text-decoration: none;
transition: all 0.25s;
white-space: nowrap;
}
.rv-btn-primary {
background: #1a1a1a;
color: #fff;
}
.rv-btn-primary:hover {
background: #b8956a;
}
.rv-btn-secondary {
background: #fff;
color: #1a1a1a;
border: 1.5px solid #e8e4dd;
}
.rv-btn-secondary:hover {
background: #1a1a1a;
color: #fff;
border-color: #1a1a1a;
}
@media (max-width: 480px) {
.rv-cta-buttons {
flex-direction: column;
align-items: stretch;
padding: 0 16px;
}
.rv-btn {
text-align: center;
}
}
/* ===== Tablet: 2 cards ===== */
@media (max-width: 992px) {
.rv-card { flex: 0 0 calc((100% - 24px) / 2); }
.rv-carousel-wrap { padding: 0 50px; }
}
/* ===== Mobile: 1 card ===== */
@media (max-width: 640px) {
#reviews-section { padding: 40px 16px; }
.rv-carousel-wrap { padding: 0 44px; }
.rv-card {
flex: 0 0 100%;
padding: 24px 20px;
}
.rv-arrow {
width: 36px;
height: 36px;
font-size: 20px;
}
.rv-prev { left: 2px !important; }
.rv-next { right: 2px !important; }
#reviews-section h2 { font-size: 22px; }
}
/* ===== Extra small mobile ===== */
@media (max-width: 400px) {
.rv-carousel-wrap { padding: 0 38px; }
.rv-arrow {
width: 32px;
height: 32px;
font-size: 18px;
}
}
(function () {
const API = '/api/get-reviews.php';
const track = document.getElementById('rvTrack');
const dotsWrap = document.getElementById('rvDots');
const summary = document.getElementById('reviews-summary');
const viewport = track.parentElement;
let reviews = [];
let currentIndex = 0;
let autoTimer = null;
let isPaused = false;
let touchStartX = 0;
let touchEndX = 0;
// ---------- Helpers ----------
function esc(s) {
return String(s).replace(/[&"']/g, function (c) {
return { '&':'&', '':'>', '"':'"', "'":''' }[c];
});
}
function cardsPerView() {
if (window.innerWidth <= 640) return 1;
if (window.innerWidth <= 992) return 2;
return 3;
}
function maxIndex() {
return Math.max(0, reviews.length - cardsPerView());
}
// ---------- Render ----------
function renderCards() {
if (!reviews.length) {
track.innerHTML = '
No reviews yet.
';
return;
}
let html = '';
reviews.forEach(function (r) {
const stars = '★'.repeat(r.rating) + '☆'.repeat(5 - r.rating);
html += '
';
html += '
' + stars + '
';
if (r.title) html += '
' + esc(r.title) + '
';
html += '
"' + esc(r.message) + '"
';
html += '
';
html += '
' + esc(r.name.charAt(0).toUpperCase()) + '
';
html += '
';
html += '
' + esc(r.name) + '
';
if (r.city) html += '
' + esc(r.city) + '
';
html += '
';
});
track.innerHTML = html;
buildDots();
}
function buildDots() {
const total = maxIndex() + 1;
if (total <= 1) { dotsWrap.innerHTML = ''; return; }
let html = '';
for (let i = 0; i < total; i++) {
html += '
';
}
dotsWrap.innerHTML = html;
}
function updateDots() {
const dots = dotsWrap.querySelectorAll('.rv-dot');
dots.forEach(function (d, i) {
d.classList.toggle('active', i === currentIndex);
});
}
// ---------- Movement ----------
function updatePosition() {
const card = track.querySelector('.rv-card');
if (!card) return;
const cardWidth = card.getBoundingClientRect().width;
const gap = parseFloat(getComputedStyle(track).gap) || 24;
const move = currentIndex * (cardWidth + gap);
track.style.transform = 'translateX(-' + move + 'px)';
updateDots();
}
// ✅ Right to Left auto-slide
function next() {
if (currentIndex >= maxIndex()) {
currentIndex = 0; // infinite loop
} else {
currentIndex++;
}
updatePosition();
}
function prev() {
if (currentIndex 40) {
if (diff > 0) next(); // বামে swipe → পরের
else prev(); // ডানে swipe → আগের
}
isPaused = false;
}, { passive: true });
// ---------- Resize ----------
let resizeTimer;
window.addEventListener('resize', function () {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function () {
if (currentIndex > maxIndex()) currentIndex = maxIndex();
updatePosition();
buildDots();
}, 150);
});
// ---------- Global functions for inline onclick ----------
window.rvNext = next;
window.rvPrev = prev;
window.rvGoTo = function (i) {
currentIndex = Math.min(Math.max(0, i), maxIndex());
updatePosition();
};
// ---------- Fetch reviews ----------
fetch(API + '?limit=20', { cache: 'no-store' })
.then(function (res) { return res.json(); })
.then(function (data) {
if (!data.reviews || !data.reviews.length) {
track.innerHTML = '
No reviews yet.
';
return;
}
reviews = data.reviews;
if (summary) {
summary.innerHTML = '⭐
' + data.average +
' average from
' + data.total +
' reviews';
}
renderCards();
updatePosition();
startAuto();
})
.catch(function () {
track.innerHTML = '
Unable to load reviews.
';
});
})();