<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<div id="slider">
<div class="dp-wrap">
<div id="dp-slider">
<div class="dp_item" data-class="1" data-position="1">
<div class="dp-content">
<h2>Dirlis Ertugrul</h2>
<p> Lorem ipsum dolor sit, amet consectetur adipisicing elit..</p>
<a href="#" class="site-btn">Read More…</a>
</div>
<div class="dp-img">
<img class="img-fluid" src="https://i.postimg.cc/rpTXWBb0/MV5-BOTQ0-NDY0-Y2-Mt-MTdi-Yi00-Zjgz-LWJj-Nm-It-Nz-Yw-Y2-Nk-Zjll-Ym-I1-Xk-Ey-Xk-Fqc-Gde-QXVy-NDg4-Mjkz-NDk-V1.jpg" alt="investing">
</div>
</div>
<div class="dp_item" data-class="2" data-position="2">
<div class="dp-content">
<h2>Dirlis Ertugrul</h2>
<p> Lorem ipsum dolor sit, amet consectetur adipisicing elit..</p>
<a href="#" class="site-btn">Read More…</a>
</div>
<div class="dp-img">
<img class="img-fluid" src="https://i.postimg.cc/pVsWvLS0/ffbd73fd0e5e40a8443e11c9d2b29d5d.jpg" alt="investing">
</div>
</div>
<div class="dp_item" data-class="3" data-position="3">
<div class="dp-content">
<h2>Dirlis Ertugrul</h2>
<p> Lorem ipsum dolor sit, amet consectetur adipisicing elit..</p>
<a href="#" class="site-btn">Read More…</a>
</div>
<div class="dp-img">
<img class="img-fluid" src="https://i.postimg.cc/tgFRGt0P/MV5-BMGM2-Zm-E4-Yz-Mt-OTBm-NS00-Nm-E4-LWI4-NTUt-Mjg3-ZTJj-ZDYw-ZTc5-Xk-Ey-Xk-Fqc-Gde-QXVy-NDg4-Mjkz-NDk-V1.jpg" alt="investing">
</div>
</div>
<div class="dp_item" data-class="4" data-position="4">
<div class="dp-content">
<h2>Dirlis Ertugrul</h2>
<p> Lorem ipsum dolor sit, amet consectetur adipisicing elit..</p>
<a href="#" class="site-btn">Read More…</a>
</div>
<div class="dp-img">
<img class="img-fluid" src="https://i.postimg.cc/wv6zKCQ8/MV5-BNj-I4-Yj-Jl-ZTct-Mj-U5-NS00-MGFh-LWFk-Zjgt-OTlj-N2-Y4-Nz-I1-Mj-A4-Xk-Ey-Xk-Fqc-Gde-QXVy-NDg4-Mjkz-NDk-V1.jpg" alt="investing">
</div>
</div>
</div>
<span id="dp-next">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 51.401 51.401">
<defs>
<style>
.cls-1 {
fill: none;
stroke: gold;
stroke-miterlimit: 10;
stroke-width: 7px;
}
</style>
</defs>
<path id="Rectangle_4_Copy" data-name="Rectangle 4 Copy" class="cls-1" d="M32.246,0V33.178L0,31.953" transform="translate(0.094 25.276) rotate(-45)" />
</svg>
</span>
<span id="dp-prev">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 51.401 51.401">
<defs>
<style>
.cls-1 {
fill: none;
stroke: gold;
stroke-miterlimit: 10;
stroke-width: 7px;
}
</style>
</defs>
<path id="Rectangle_4_Copy" data-name="Rectangle 4 Copy" class="cls-1" d="M32.246,0V33.178L0,31.953" transform="translate(0.094 25.276) rotate(-45)" />
</svg>
</span>
<ul id="dp-dots">
<li data-class="1" class="active"></li>
<li data-class="2"></li>
<li data-class="3"></li>
<li data-class="4"></li>
</ul>
</div>
</div>
body {
margin: 0;
padding: 0;
overflow: hidden;
}
.dp-wrap {
margin: 120px auto;
position: relative;
perspective: 1000px;
height: 100%;
}
.dp-slider {
height: 100%;
width: 100%;
position: absolute;
transform-style: preserve-3d;
}
.dp-slider div {
transform-style: preserve-3d;
}
.dp_item {
display: block;
position: absolute;
text-align: center;
color: #fff;
border-radius: 10px;
transition: transform 1.2s;
}
.dp-img img {
border-left: 1px solid #fff;
}
#dp-slider .dp_item:first-child {
z-index: 10 !important;
transform: rotateY(0deg) translateX(0px) !important;
}
.dp_item[data-position="2"] {
z-index: 9;
transform: rotateY(0deg) translateX(10%) scale(0.9);
}
.dp_item[data-position="3"] {
z-index: 8;
transform: rotateY(0deg) translateX(20%) scale(0.8);
}
.dp_item[data-position="4"] {
z-index: 7;
transform: rotateY(0deg) translateX(30%) scale(0.7);
}
#dp-next,
#dp-prev {
position: absolute;
top: 50%;
right: 16%;
height: 33px;
width: 33px;
z-index: 10;
cursor: pointer;
}
#dp-prev {
left: 15px;
transform: rotate(180deg);
}
#dp-dots {
position: absolute;
bottom: 25px;
z-index: 12;
left: 38%;
cursor: default;
}
#dp-dots li {
display: inline-block;
width: 13px;
height: 13px;
background: #fff;
border-radius: 50%;
}
#dp-dots li:hover {
cursor: pointer;
background: goldenrod;
transition: background 0.3s;
}
#dp-dots li.active {
background: goldenrod;
}
.dp_item {
width: 85%;
}
.dp-content,
.dp-img {
text-align: left;
}
.dp_item {
display: flex;
align-items: center;
background: #fff;
border-radius: 10px;
overflow: hidden;
border-top: none;
}
.dp-content {
padding-left: 100px;
padding-right: 0;
display: inline-block;
width: 100%;
}
.dp-content h2 {
color: #41414b;
font-family: Circular Std Bold;
font-size: 48px;
max-width: 460px;
margin-top: 8px;
margin-bottom: 0px;
}
.dp-content p {
color: #74747f;
max-width: 490px;
margin-top: 15px;
font-size: 24px;
}
.dp-content .site-btn {
margin-top: 15px;
font-size: 18px;
padding: 19px 40px;
}
.dp-img:before {
background: -webkit-linear-gradient(
-90deg,
rgba(255, 255, 255, 0.25),
rgba(255, 255, 255, 0)
);
background: -o-linear-gradient(
-90deg,
rgba(255, 255, 255, 0.25),
rgba(255, 255, 255, 0)
);
background: -moz-linear-gradient(
-90deg,
rgba(255, 255, 255, 0.25),
rgba(255, 255, 255, 0)
);
background: linear-gradient(
-90deg,
rgba(255, 255, 255, 0.75),
rgba(255, 255, 255, 0)
);
content: "";
position: absolute;
height: 100%;
width: 25%;
z-index: 1;
top: 0;
pointer-events: none;
background: -webkit-linear-gradient(
-90deg,
rgba(255, 255, 255, 0),
rgba(255, 255, 255, 0.75)
);
background: -o-linear-gradient(
-90deg,
rgba(255, 255, 255, 0),
rgba(255, 255, 255, 0.75)
);
background: -moz-linear-gradient(
-90deg,
rgba(255, 255, 255, 0),
rgba(255, 255, 255, 0.75)
);
background: linear-gradient(
-90deg,
rgba(255, 255, 255, 0),
rgb(255, 255, 255)
);
}
.dp-img img {
object-fit: cover;
object-position: right;
}
#dp-slider,
.dp-img img {
height: 738px;
}
#dp-slider .dp_item:hover:not(:first-child) {
cursor: pointer;
}
.site-btn {
color: #fff;
font-size: 18px;
font-family: "Circular Std Medium";
background: goldenrod;
padding: 14px 33px;
display: inline-block;
border-radius: 50px;
position: relative;
top: -10px;
text-decoration: none;
}
.site-btn:hover {
text-decoration: none;
color: #fff;
}
$(document).ready(function () {
function detect_active() {
// get active
var get_active = $("#dp-slider .dp_item:first-child").data("class");
$("#dp-dots li").removeClass("active");
$("#dp-dots li[data-class=" + get_active + "]").addClass("active");
}
$("#dp-next").click(function () {
var total = $(".dp_item").length;
$("#dp-slider .dp_item:first-child").hide().appendTo("#dp-slider").fadeIn();
$.each($(".dp_item"), function (index, dp_item) {
$(dp_item).attr("data-position", index + 1);
});
detect_active();
});
$("#dp-prev").click(function () {
var total = $(".dp_item").length;
$("#dp-slider .dp_item:last-child").hide().prependTo("#dp-slider").fadeIn();
$.each($(".dp_item"), function (index, dp_item) {
$(dp_item).attr("data-position", index + 1);
});
detect_active();
});
$("#dp-dots li").click(function () {
$("#dp-dots li").removeClass("active");
$(this).addClass("active");
var get_slide = $(this).attr("data-class");
console.log(get_slide);
$("#dp-slider .dp_item[data-class=" + get_slide + "]")
.hide()
.prependTo("#dp-slider")
.fadeIn();
$.each($(".dp_item"), function (index, dp_item) {
$(dp_item).attr("data-position", index + 1);
});
});
$("body").on("click", "#dp-slider .dp_item:not(:first-child)", function () {
var get_slide = $(this).attr("data-class");
console.log(get_slide);
$("#dp-slider .dp_item[data-class=" + get_slide + "]")
.hide()
.prependTo("#dp-slider")
.fadeIn();
$.each($(".dp_item"), function (index, dp_item) {
$(dp_item).attr("data-position", index + 1);
});
detect_active();
});
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.