The content on this website, including videos and code examples, is for educational purposes only. All demonstrations and designs are fictional and created to illustrate coding techniques. Any resemblance to existing websites or brands is purely coincidental.
The creators and administrators of this website do not claim ownership or affiliation with any existing websites or companies. Users are encouraged to use the information responsibly for learning purposes. Liability for any misuse of the content provided is not accepted.
Below is the html code for this video.
index.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>Vertical Image Carousel #4</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="carousel">
<div class="slides slide1 slide-active" data-slide="1">
<div class="slide slide-left">
<div class="content">
<h4 class="subtitle">Subtitle 1</h4>
<h1 class="title">Title 1</h1>
<p class="description">Description 1</p>
</div>
<p class="text-bg">Title 1</p>
</div>
<div class="slide slide-right"></div>
<img class="img-slide" alt="img slide1"
src="https://images.unsplash.com/photo-1463438690606-f6778b8c1d10?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=687&q=80" />
</div>
<div class="slides slide2 start-animation" data-slide="2">
<div class="slide slide-left">
<div class="content">
<h4 class="subtitle">Subtitle 2</h4>
<h1 class="title">Title 2</h1>
<p class="description">Description 2</p>
</div>
<p class="text-bg">Title 2</p>
</div>
<div class="slide slide-right"></div>
<img class="img-slide" alt="img slide2"
src="https://images.unsplash.com/photo-1603107776328-0a2e5b7d08e6?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=736&q=80" />
</div>
<div class="slides slide3 start-animation" data-slide="3">
<div class="slide slide-left">
<div class="content">
<h4 class="subtitle">Subtitle 3</h4>
<h1 class="title">Title 3</h1>
<p class="description">Description 3</p>
</div>
<p class="text-bg">Title 3</p>
</div>
<div class="slide slide-right"></div>
<img class="img-slide" alt="img slide3"
src="https://images.unsplash.com/photo-1623595119708-26b1f7300075?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=683&q=80" />
</div>
</div>
<div class="indicators">
<a href="#" class="indicator active" data-slide="1">Title 1</a>
<a href="#" class="indicator" data-slide="2">Title 2</a>
<a href="#" class="indicator" data-slide="3">Title 3</a>
</div>
<script src="https://code.jquery.com/jquery-3.6.1.slim.min.js"
integrity="sha256-w8CvhFs7iHNVUtnSP0YKEg00p9Ih13rlL9zGqvLdePA=" crossorigin="anonymous"></script>
<script src="index.js"></script>
</body>
</html>
Below is the css code for this video.
style.css
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
position: relative;
height: 100vh;
}
.slides {
position: absolute;
top: 0;
left: 0;
display: flex;
height: 100vh;
width: 100%;
justify-content: flex-start;
flex-flow: row wrap;
z-index: 1;
}
.slides.slide-active {
z-index: 2;
}
.subtitle {
font-family: monospace;
font-size: 24px;
color: rgba(255, 255, 255, 0.875);
margin-bottom: 2.5%;
text-transform: uppercase;
letter-spacing: 10px;
}
.title {
font-family: sans-serif;
font-size: 90px;
color: rgba(255, 255, 255, 1);
font-weight: 700;
line-height: 90px;
}
.description {
font-family: serif;
font-size: 16px;
color: rgba(255, 255, 255, 0.75);
line-height: 22px;
margin-top: 2.5%;
}
.text-bg {
position: absolute;
left: 7.5%;
bottom: 0;
font-family: sans-serif;
font-size: 120px;
font-weight: 700;
color: rgba(0, 0, 0, 0.25);
}
.slide {
height: 100vh;
transition: transform 0.25s linear;
}
.slide-left {
position: relative;
width: 65%;
display: flex;
align-items: center;
transform-origin: left bottom;
transition: transform 0.25s linear 0.5s;
opacity: 0;
overflow: hidden;
}
.slide-right {
width: 35%;
transform-origin: right center;
transition: transform 0.25s linear;
opacity: 0;
}
.slide-prestart .slide-left, .slide-prestart .slide-right, .slide-active .slide-left, .slide-active .slide-right {
opacity: 1;
}
.slide1 .slide-left {
background-color: #718b18;
}
.slide1 .slide-right {
background-color: #fb97c2;
}
.slide2 .slide-left {
background-color: #28445a;
}
.slide2 .slide-right {
background-color: #b0bb9b;
}
.slide3 .slide-left {
background-color: #b02d08;
}
.slide3 .slide-right {
background-color: #ffebcd;
}
.content {
width: 75%;
margin-left: 7.5%;
transform: translate3d(0, 0, 0);
opacity: 1;
transition: transform 0.25s linear 0.25s, opacity 0.25s linear 0.5s;
}
.img-slide {
position: absolute;
bottom: 2.5%;
right: 17.5%;
max-height: 40vw;
transform: translate3d(0, 0, 0);
opacity: 1;
transition: opacity 0.25s 0.5s, transform 0.5s 0.75s cubic-bezier(0, 0.75, 0.5, 1);
}
.slides.start-animation .content {
transform: translate3d(0, -200%, 0);
opacity: 0;
}
.slides.start-animation .img-slide {
transform: translate3d(-200px, 0, 0);
opacity: 0;
}
.slides.end-animation .slide-left {
transform: scaleY(0);
}
.slides.end-animation .slide-right {
transform: scaleX(0);
}
.slides.end-animation .content {
transform: translate3d(0, 200%, 0);
opacity: 0;
}
.slides.end-animation .img-slide {
transform: translate3d(200px, 0, 0);
opacity: 0;
}
.indicators {
position: absolute;
top: 50%;
right: 2.5%;
transform: translateY(-50%);
z-index: 999;
}
.indicator {
display: block;
height: 20px;
width: 20px;
background-color: rgba(0, 0, 0, 0.75);
border: 1px dotted #000000;
border-radius: 50%;
margin: 20px 0;
box-shadow: none;
text-indent: -9999px;
}
.indicators a.active {
background-color: #ffffff;
}
Below is the javascript code for this video.
index.js
$('.indicator').on('click', function (e) {
e.preventDefault();
var current = $('.slide-active').data('slide');
var next = $(this).data('slide');
$('.indicator').removeClass('active');
$(this).addClass('active');
if (current === next) {
return false;
} else {
$('.carousel').find('.slides[data-slide=' + next + ']').addClass('slide-prestart');
$('.slide-active').addClass('end-animation');
setTimeout(function () {
$('.slide-prestart').removeClass('start-animation slide-prestart').addClass('slide-active');
$('.end-animation').addClass('start-animation').removeClass('end-animation slide-active');
}, 1000);
}
});
Thanks for visiting