Mon - Sun 8.00 AM - 8.00 PM
[email protected]
Home
Articles
Our Courses
HTML 5
CSS
JavaScript
MySql
PHP
Laravel
Bootstrap
Our Tutorials
PHP
JavaScript
HTML
Laravel
MySQL
JQuery
CSS
Git
Bootstrap
Vue JS
Android
Ui Code Snippets
Chat Box
Range Slider
Radio Button
Select Box
Nav Bar
Other
Testimonial
Carousel
Logo
Loader
Lightbox
Login Form
Modals
OTP Verification Form
Popular Notes
HTML
CSS
JavaScript
SQL
Services
About
Contact Us
Ui Code
Snippets
Testimonial With HTML, CSS and Pure javaScript
HTML
CSS
JS
Output
HTML
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Testimonial With HTML, CSS and Pure javaScript</title> </head> <body> <div id="carouselBox"> <div class="wrapperDivArea"> <div class="testimonial-main-div" id="testimonial-main-div"> <div id="testimonial1" class="active"> <img src="" /> </div> </div> <button id="prevBtn" onclick="prevBtn()"><</button> <button id="nextBtn" onclick="nextBtn()">></button> </div> <a href="https://www.teknowize.com/" target="_blank"><img src="https://www.teknowize.com/front-assets/images/logo/logo.png" alt=""></a> </div> </body> </html>
CSS
* { padding: 0; margin: 0; -webkit-box-sizing: border-box; box-sizing: border-box; font-family: "Poppins", sans-serif; } body { background-color: #e0ecee; } #carouselBox { position: absolute; -webkit-transform: translate(-50%, -50%); -ms-transform: translate(-50%, -50%); transform: translate(-50%, -50%); top: 50%; left: 50%; width: 80vw; max-width: 41em; min-height: 26em; } .wrapperDivArea { background-color: #ffffff; position: relative; display: -webkit-box; display: -ms-flexbox; display: flex; border-radius: 0.6em; -webkit-box-shadow: 0 1.8em 3em rgba(1, 17, 39, 0.15); box-shadow: 0 1.8em 3em rgba(1, 17, 39, 0.15); } .testimonial-main-div { width: 85%; height: 100%; position: relative; margin: auto; padding: 1.8em 1.2em; } .testimonial-main-div p { color: #8c8c90; text-align: center; font-size: 0.9em; line-height: 2em; letter-spacing: 0.05em; } .testimonial-main-div img { display: block; margin: 1.8em auto 1.25em auto; border-radius: 50%; width: 4.4em; } .testimonial-main-div h3 { color: #2d3d67; font-size: 1em; text-align: center; } .testimonial-main-div h6 { color: #bcc4da; font-size: 0.9em; letter-spacing: 0.03em; font-weight: 400; text-align: center; } .wrapperDivArea button { font-size: 1.8em; color: #0a69ed; height: 2.2em; width: 2.2em; position: absolute; margin: auto; top: 0; bottom: 0; background-color: #ffffff; border: none; border-radius: 50%; -webkit-box-shadow: 0 0 1em rgba(0, 0, 0, 0.25); box-shadow: 0 0 1em rgba(0, 0, 0, 0.25); cursor: pointer; } button#nextBtn { right: -1.1em; } button#prevBtn { left: -1.1em; } a { position: relative; display: block; background-color: #ffffff; color: #0a69ed; text-decoration: none; font-size: 1.2em; font-weight: 600; text-align: center; padding: 0.9em 0; border-radius: 0.3em; margin-top: 30px; } .fab { color: #ff0000; } @media screen and (max-width: 650px) { .wrapperDivArea { font-size: 14px; } }
JS
const testimonials = [ { name: "Rahul Tripathi", job: "Web Developer", image: "https://www.teknowize.com/attachments/file_1658671093.png", testimonial: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the printer took a galley of type and scrambled industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled" }, { name: "Rohit Shetty", job: "Web Designer", image: "https://www.teknowize.com/attachments/file_1658671341.png", testimonial: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the printer took a galley of type and scrambled industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled" }, { name: "Nicolas Puran", job: "UI Designer, Affinity Agency", image: "https://www.teknowize.com/attachments/file_1658671252.png", testimonial: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem printer took a galley of type and scrambled Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled" }, { name: "Priya Tyagi", job: "Network Markting", image: "https://www.teknowize.com/attachments/file_1658671141.png", testimonial: "Sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit" } ]; let i = 0; // current slide let j = testimonials.length; // total slides let testimonialContainer = document.getElementById("testimonial-main-div"); function nextBtn() { i = (j + i + 1) % j; displayTestimonial(); } function prevBtn() { i = (j + i - 1) % j; displayTestimonial(); } let displayTestimonial = () => { testimonialContainer.innerHTML = ` <p>${testimonials[i].testimonial}</p> <img src=${testimonials[i].image}></img> <h3>${testimonials[i].name}</h3> <h6>${testimonials[i].job}</h6> `; }; window.onload = displayTestimonial;
Output