Our Specialist Team
Certified & Results-Driven
// همکاران ما در صفحه درباره ما
document.addEventListener("DOMContentLoaded",()=>{
const testimonials = document.querySelectorAll(".testimonials")
const nextBtnte = document.querySelector(".next-btn-te")
const prevBtnte = document.querySelector(".prev-btn-te")
const testimonialsContainer = document.querySelector(".testimonials-container")
let maxPos = testimonials.length;
function updateClasses (isNext){
testimonials.forEach(box=>{
const currentPos = [...box.classList].find(cls=> cls.startsWith("pos"));
const numberPos = parseInt(currentPos.split("_")[1]);
box.classList.remove(currentPos)
let newPos ;
if(isNext){
newPos = numberPos + 1;
}else{
newPos = numberPos - 1;
}
if(newPos > maxPos){
newPos = 1;
}else if(newPos {
updateClasses(true)
})
prevBtnte.addEventListener('click',()=>{
updateClasses(false)
})
let touchXStart = 0;
let touchXEnd = 0;
function touchUpdate(){
if(touchXStart > touchXEnd && touchXStart - touchXEnd > 30){
updateClasses(false)
}else if(touchXStart 30){
updateClasses(true)
}
}
testimonialsContainer.addEventListener("mousedown",(e)=>{
touchXStart = e.x;
})
testimonialsContainer.addEventListener("mouseup",(e)=>{
touchXEnd = e.x;
touchUpdate()
})
testimonialsContainer.addEventListener("touchstart",(e)=>{
touchXStart = e.changedTouches[0].screenX;
})
testimonialsContainer.addEventListener("touchend",(e)=>{
touchXEnd = e.changedTouches[0].screenX;;
touchUpdate()
})
})