caddy-website/new/resources/js/home.js

17 lines
646 B
JavaScript
Raw Normal View History

2023-10-10 12:03:33 -06:00
const resp = fetch("/resources/testimonials.json").then(async resp => {
const testimonials = await resp.json();
2023-10-07 16:43:39 -06:00
console.log(testimonials);
2023-10-10 12:03:33 -06:00
ready(function() {
for (let i = 0; i < testimonials.length; i++) {
const testimonial = testimonials[i];
const tpl = cloneTemplate('#tpl-testimonial');
$('.testimonial-picture', tpl).src = testimonial.picture || "";
$('.testimonial-quote', tpl).innerText = `"${testimonial.quote}"`;
$('.testimonial-name', tpl).innerText = testimonial.name || "";
$('.testimonial-role', tpl).innerText = testimonial.role || "";
$(`.testimonial-col:nth-child(${i%3 + 1})`).append(tpl);
}
});
});