-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestionial_slider.html
More file actions
31 lines (27 loc) · 829 Bytes
/
testionial_slider.html
File metadata and controls
31 lines (27 loc) · 829 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<div class="testimonial">
<p>"This is an amazing service!"</p>
<h4>- John Doe</h4>
</div>
<script>
const testimonials = [
'"This is an amazing service!" - John Doe',
'"I love using this product!" - Jane Smith',
'"Highly recommend to everyone!" - Alice Brown',
];
let i = 0;
function changeTestimonial() {
document.querySelector(".testimonial p").innerText = testimonials[i].split(" - ")[0];
document.querySelector(".testimonial h4").innerText = `- ${testimonials[i].split(" - ")[1]}`;
i = (i + 1) % testimonials.length;
}
setInterval(changeTestimonial, 3000);
</script>
<style>
.testimonial {
width: 300px;
text-align: center;
padding: 20px;
border: 2px solid #ddd;
border-radius: 10px;
}
</style>