<html lang="en" dir="ltr">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<meta charset="utf-8">
<title>Flexbox Testimonials</title>
</head>
<body>
<div class="col-sm-7 mx-auto">
<header class="section-header text-center">
<span class="h1 d-block">
<span>❝</span>
</span>
<h2>Happy Customers</h2>
</header>
</div>
<div id="flex-container" class="testimonials">
<div id="left-zone">
<ul class="list">
<li class="item">
<input type="radio" id="radio_testimonial-1" name="basic_carousel" checked="checked" />
<label class="label_testimonial-1" for="radio_testimonial-1">Diamond Pest Elimination</label>
<div class="content-test content_testimonial-1">
<span class="picto"></span>
<h1>Diamond Pest Elimination</h1>
<p>“The team really takes pride in their work. If I didn’t know any better I would think they actually worked for my company.”</p>
<p class="testimonialFrom">Bill, Owner</p>
<p class="testimonialState">Rochester, NY</p>
</div>
</li>
<li class="item">
<input type="radio" id="radio_testimonial-2" name="basic_carousel" />
<label class="label_testimonial-2" for="radio_testimonial-2">A+ Handyman Service</label>
<div class="content-test content_testimonial-2">
<span class="picto"></span>
<h1>A+ Handyman Service</h1>
<p>“Quite simply… the service offers prompt response time to my visitors and helps me to better know what type of project a potential customer wants.”</p>
<p class="testimonialFrom">Bill, Owner</p>
<p class="testimonialState">Tucson, AZ</p>
<br>
</div>
</li>
<li class="item">
<input type="radio" id="radio_testimonial-3" name="basic_carousel" />
<label class="label_testimonial-3" for="radio_testimonial-3">Mod Movers</label>
<div class="content-test content_testimonial-3">
<span class="picto"></span>
<h1>Mod Movers</h1>
<p>“I couldn’t believe it. I actually had to hire someone to help me keep up with the new business. I had no idea my website had so much value.”</p>
<p class="testimonialFrom">Marlene, Owner</p>
<p class="testimonialState">Monterey, CA</p>
</div>
</li>
<li class="item">
<input type="radio" id="radio_testimonial-4" name="basic_carousel" />
<label class="label_testimonial-4" for="radio_testimonial-4">AK Pest Control</label>
<div class="content-test content_testimonial-4">
<span class="picto"></span>
<h1>AK Pest Control</h1>
<p>Great company to send leads. Very efficient and pleased with the services. We get lots of leads and that whats important. Support is also great from the managers/support. Thanks YPC Chat</p>
<p class="testimonialFrom">Mark, Owner</p>
<p class="testimonialState">Somerset, VA</p>
<br>
</div>
</li>
</ul>
</div>
<div id="right-zone"></div>
</div>
</body>
</html>
body {
background: #eee;
font-family: Tahoma;
user-select: none;
user-select: none;
user-select: none;
user-select: none;
padding-top: 20px;
}
.d-block, h2{
color: #33475c;
font-weight: 700;
font-size: 2.5rem;
display: block;
margin: 0 auto;
text-align: center;
padding-bottom: 20px;
}
/* ============= Begin Testimonial Flexbox ============ */
#flex-container {
display: box;
display: flexbox;
display: flex;
flex-wrap: wrap;
flex-wrap: wrap;
box-pack: center;
flex-pack: center;
justify-content: center;
box-align: center;
flex-align: center;
align-items: center;
width: 100%;
min-height: 400px;
height: 110vh;
max-width: 1000px;
margin: auto;
background-color: #fff;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12),
0 1px 2px rgba(0, 0, 0, 0.24);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
overflow: hidden;
box-orient: vertical;
box-direction: normal;
flex-direction: column;
flex-direction: column;
position: relative;
}
#left-zone {
height: 50%;
box-flex: 0;
flex: 0 0 auto;
flex: 0 0 auto;
display: box;
display: flexbox;
display: flex;
width: 100%;
}
#left-zone .list {
display: box;
display: flexbox;
display: flex;
list-style: none;
flex-line-pack: stretch;
align-content: stretch;
box-orient: vertical;
box-direction: normal;
flex-direction: column;
flex-direction: column;
box-flex: 1;
flex: 1 1 auto;
flex: 1 1 auto;
margin: auto;
padding: 0;
box-sizing: border-box;
box-sizing: border-box;
}
.item input {
display: none;
}
label {
display: block;
opacity: 0.5;
height: 50px;
text-align: center;
line-height: 50px;
position: relative;
}
label:hover {
opacity: 0.75;
cursor: pointer;
}
.content-test {
position: absolute;
right: 0;
bottom: 0;
opacity: 0;
transform: translateY(100%);
transform: translateY(100%);
transform: translateY(100%);
height: 50%;
width: 100%;
transition: 0.5s ease-out;
transition: 0.5s ease-out;
transition: 0.5s ease-out;
display: box;
display: flexbox;
display: flex;
box-align: center;
flex-align: center;
align-items: center;
box-pack: center;
flex-pack: center;
justify-content: center;
box-orient: vertical;
box-direction: normal;
flex-direction: column;
flex-direction: column;
pointer-events: none;
}
.content-test p {
max-width: 50%;
text-align: center;
}
#right-zone {
width: 100%;
box-flex: 1;
flex: 1 0 auto;
flex: 1 0 auto;
height: 50%;
}
input:checked ~ .content-test {
transform: translateY(0%);
transform: translateY(0%);
transform: translateY(0%);
transition: transform 1s;
transition: transform 1s;
transition: transform 1s;
transition: transform 1s;
transition: transform 1s, transform 1s;
opacity: 1;
}
@media (min-width: 480px) {
#flex-container {
box-orient: horizontal;
box-direction: normal;
flex-direction: row;
flex-direction: row;
min-height: auto;
height: 400px;
/* position: absolute; */
top: 0;
bottom: 0;
left: 0;
right: 0;
}
#left-zone .list {
border-right: 2px solid #cccccc;
}
.content-test {
width: 65%;
height: 100%;
pointer-events: auto;
transform: translateY(-100%);
transform: translateY(-100%);
transform: translateY(-100%);
}
#left-zone {
width: 35%;
}
#right-zone {
height: 100%;
width: 65%;
}
}
/* If the screen size is 480px or less */
@media (max-width: 480px) {
.content_testimonial-1 .picto {
padding-top: 100px;
}
.content_testimonial-2 .picto {
padding-top: 100px;
}
.content_testimonial-3 .picto {
padding-top: 100px;
}
.content_testimonial-4 .picto {
padding-top: 100px;
}
.item > label {
font-size: 1.3rem;
}
}
.content_testimonial-1 .picto {
height: 100px;
width: 100px;
background-image: url("https://i.postimg.cc/RFBHkG46/diamond-Pest-Logo-small.jpg");
background-position: center;
background-size: cover;
background-repeat: no-repeat;
}
.content_testimonial-1 h1 {
color: #d64541;
text-align: center;
}
.content_testimonial-2 .picto {
height: 100px;
width: 100px;
background-image: url("https://i.postimg.cc/bsqXXKCV/a-Plus-Handyman-Logo.jpg");
background-position: center;
background-size: cover;
background-repeat: no-repeat;
}
.content_testimonial-2 h1 {
color: #f5d76e;
}
.content_testimonial-3 .picto {
height: 100px;
width: 100px;
background-image: url("https://i.postimg.cc/zV7sq04z/mod-Movers-Logo.jpg");
background-position: center;
background-size: cover;
background-repeat: no-repeat;
}
.content_testimonial-3 h1 {
color: #00b16a;
}
.content_testimonial-4 .picto {
height: 100px;
width: 100px;
background-image: url("https://i.postimg.cc/4Y3rypTz/ak-Pest-Control-Logo.jpg");
background-position: center;
background-size: cover;
background-repeat: no-repeat;
}
.content_testimonial-4 h1 {
color: #f27935;
}
.content-test h1:first-letter {
text-transform: uppercase;
}
input:checked ~ label {
opacity: 1;
animation: all 1s cubic-bezier(0.455, 0.03, 0.515, 0.955);
animation: all 1s cubic-bezier(0.455, 0.03, 0.515, 0.955);
}
input:checked ~ label.label_testimonial-1 {
color: #d64541;
border-right: solid 4px #d64541;
}
input:checked ~ label.label_testimonial-2 {
color: #f5d76e;
border-right: solid 4px #f5d76e;
}
input:checked ~ label.label_testimonial-3 {
color: #00b16a;
border-right: solid 4px #00b16a;
}
input:checked ~ label.label_testimonial-4 {
color: #f27935;
border-right: solid 4px #f27935;
}
label.label_testimonial-1:before {
content: " ";
display: block;
position: absolute;
width: 50px;
height: 50px;
margin-left: 15px;
background-image: url("https://i.postimg.cc/RFBHkG46/diamond-Pest-Logo-small.jpg");
background-position: center;
background-size: 75% 75%;
background-repeat: no-repeat;
border-radius: 50%;
}
label.label_testimonial-2:before {
content: " ";
display: block;
position: absolute;
width: 50px;
height: 50px;
margin-left: 15px;
background-image: url("https://i.postimg.cc/bsqXXKCV/a-Plus-Handyman-Logo.jpg");
background-position: center;
background-size: 75% 75%;
border-radius: 50%;
background-repeat: no-repeat;
}
label.label_testimonial-3:before {
content: " ";
display: block;
position: absolute;
width: 50px;
height: 50px;
margin-left: 15px;
background-image: url("https://i.postimg.cc/zV7sq04z/mod-Movers-Logo.jpg");
background-position: center;
background-size: 75% 75%;
background-repeat: no-repeat;
border-radius: 50%;
}
label.label_testimonial-4:before {
content: " ";
display: block;
position: absolute;
width: 50px;
height: 50px;
margin-left: 15px;
background-image: url("https://i.postimg.cc/4Y3rypTz/ak-Pest-Control-Logo.jpg");
background-position: center;
background-size: 75% 75%;
background-repeat: no-repeat;
border-radius: 50%;
}
label:first-letter {
text-transform: uppercase;
}
.label_testimonial-1:hover {
background-image: gradient(
linear,
left top,
right top,
from(#ffffff),
to(#d64541a3)
);
background-image: linear-gradient(left, #ffffff, #d64541a3);
background-image: linear-gradient(left, #ffffff, #d64541a3);
background-image: linear-gradient(to right, #ffffff, #d64541a3);
font-size: 1.2rem;
transition: font-size 0.5s;
transition: font-size 0.5s;
transition: font-size 0.5s;
}
.label_testimonial-2:hover {
background-image: gradient(
linear,
left top,
right top,
from(#ffffff),
to(#f5d76e59)
);
background-image: linear-gradient(left, #ffffff, #f5d76e59);
background-image: linear-gradient(left, #ffffff, #f5d76e59);
background-image: linear-gradient(to right, #ffffff, #f5d76e59);
font-size: 1.2rem;
transition: font-size 0.5s;
transition: font-size 0.5s;
transition: font-size 0.5s;
}
.label_testimonial-3:hover {
background-image: gradient(
linear,
left top,
right top,
from(#ffffff),
to(#00b16aa3)
);
background-image: linear-gradient(left, #ffffff, #00b16aa3);
background-image: linear-gradient(left, #ffffff, #00b16aa3);
background-image: linear-gradient(to right, #ffffff, #00b16aa3);
font-size: 1.2rem;
transition: font-size 0.5s;
transition: font-size 0.5s;
transition: font-size 0.5s;
}
.label_testimonial-4:hover {
background-image: gradient(
linear,
left top,
right top,
from(#ffffff),
to(#f27935a3)
);
background-image: linear-gradient(left, #ffffff, #f27935a3);
background-image: linear-gradient(left, #ffffff, #f27935a3);
background-image: linear-gradient(to right, #ffffff, #f27935a3);
font-size: 1.2rem;
transition: font-size 0.5s;
transition: font-size 0.5s;
transition: font-size 0.5s;
}
p.testimonialState {
margin-top: -5px;
font-size: 0.8rem;
font-style: italic;
color: #808080d4;
}
p.testimonialFrom {
margin-top: 5px;
font-weight: bold;
color: #33475c;
}
/* ============== End Testimonial Flexbox ============= */
// Makeshift carousel function that gets invoked with the Index to start it off, then the callback increments the index to recursively invoke the same function. Works even in IE11!
var testimonialItems = document.querySelectorAll(".item label");
var timer;
function cycleTestimonials(index) {
timer = setTimeout(function() {
var evt;
if (document.createEvent){
//If browser = IE, then polyfill
evt = document.createEvent('MouseEvent');
evt.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
} else {
//If Browser = modern, then create new MouseEvent
evt = new MouseEvent("click", {
view: window,
bubbles: true,
cancelable: true,
clientX: 20
});
}
var ele = "." + testimonialItems[index].className;
var ele2 = document.querySelector(ele)
ele2.dispatchEvent(evt);
index++; // Increment the index
if (index >= testimonialItems.length) {
index = 0; // Set it back to `0` when it reaches `3`
}
cycleTestimonials(index); // recursively call `cycleTestimonials()`
document.querySelector(".testimonials").addEventListener("click", function() {
clearTimeout(timer); //stop the carousel when someone clicks on the div
});
}, 2000); //adjust scroll speed in miliseconds
}
//run the function
cycleTestimonials(0);
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.