// testimonial
let testimonialCard = document.getElementById("card-container");
let rightArrow = document.getElementById("right-arrow");
let leftArrow = document.getElementById("left-arrow");
let cardPosition = testimonialCard.style.transform;
let count = 0;
let slideSize = 100.0 / testimonialCard.childElementCount;
let slideToMove;
testimonialCard.style.width = testimonialCard.childElementCount * 100.0 + "%";
leftArrow.addEventListener('click', ()=>{
testimonialCard.classList.remove('slide');
if(count >= 0){
if(count>=1){
count--;
}
slideToMove = slideSize * count;
testimonialCard.style.transform = "translateX(-" + slideToMove + "%)";
}
});
rightArrow.addEventListener('click', ()=>{
testimonialCard.classList.remove('slide');
if(count < (testimonialCard.childElementCount - 1)){
count++;
slideToMove = slideSize * count;
testimonialCard.style.transform = "translateX(-" + slideToMove + "%)";
}
});
// form submit
const scriptURL = 'https://script.google.com/macros/s/AKfycbzmAGNzUOCtFXaPoDqlXjQfpwTStye7f_P26ujdedLKNNZo7j7KP1pkuyTQda7iWei5ug/exec';
const form = document.getElementById('my-form');
function formSubmit(){
form.reset();
location.assign("https://www.541junkremoval.com/thankyou");
}
form.addEventListener('submit', e =>{
e.preventDefault()
fetch(scriptURL, {method: 'POST', body: new FormData(form), crossDomain: true,
dataType: 'jsonp',
})
.then(response => formSubmit())
.catch(error => console.error('Error!',error.message))
})