Vertical Timeline
$(window).on('scroll', function() {
$('.cd-timeline-block').each(function() {
if(
$(this).offset().top <= $(window).scrollTop()+$(window).height()*0.75 &&
$(this).find('.cd-timeline-img').hasClass('is-hidden')
) {
$(this).find('.cd-timeline-img, .cd-timeline-content').removeClass('is-hidden').addClass('bounce-in');
}
});
});#cd-timeline {
position: relative;
padding: 2em 0;
margin-top: 2em;
margin-bottom: 2em;
}
#cd-timeline::before {
/* this is the vertical line */
content: '';
position: absolute;
top: 0;
height: 100%;
width: 4px;
background: #d7e4ed;
left: 50%;
margin-left: -2px;
}
.cd-container::after {
content: '';
display: table;
clear: both;
}
.cd-container {
width: 90%;
max-width: 1170px;
margin: 0 auto;
}
.cd-timeline-block:first-child {
margin-top: 0;
}
.cd-timeline-block {
position: relative;
margin: 4em 0;
}
.cd-timeline-content {
margin-left: 0;
padding: 1.6em;
width: 42%;
position: relative;
background: white;
border-radius: 0.25em;
padding: 1em;
box-shadow: 0 3px 0 #d7e4ed;
}
.cd-timeline-content .cd-date {
position: absolute;
width: 100%;
left: 122%;
top: 6px;
font-size: 16px;
font-size: 1rem;
}
.cd-timeline-block:nth-child(even) .cd-timeline-content .cd-date {
left: auto;
right: 122%;
text-align: right;
}
.cd-timeline-block:nth-child(even) .cd-timeline-content {
float: right;
}
.cd-timeline-block:after {
content: "";
display: table;
clear: both;
}
.cd-timeline-img {
width: 60px;
height: 60px;
left: 50%;
margin-left: -30px;
-webkit-transform: translateZ(0);
-webkit-backface-visibility: hidden;
}
.cd-timeline-img {
position: absolute;
top: 0;
border-radius: 50%;
box-shadow: 0 0 0 4px white, inset 0 2px 0 rgba(0, 0, 0, 0.08), 0 3px 0 4px rgba(0, 0, 0, 0.05);
background: #105a8b;
}
.cd-timeline-img img,.cd-timeline-img svg {
display: block;
width: 24px;
height: 24px;
position: relative;
left: 50%;
top: 50%;
margin-left: -12px;
margin-top: -12px;
vertical-align: middle;
}
.cssanimations .cd-timeline-img.is-hidden,.cssanimations .cd-timeline-content.is-hidden {
visibility: hidden;
}
.cssanimations .cd-timeline-img.bounce-in,.cssanimations .cd-timeline-content.bounce-in {
visibility: visible;
animation: cd-bounce-1 0.6s;
}
@keyframes cd-bounce-1 {
0% {
opacity: 0;
transform: scale(0.5);
}
60% {
opacity: 1;
transform: scale(1.2);
}
100% {
transform: scale(1);
}
}<!-- main timeline section -->
<section id="cd-timeline" class="cd-container cssanimations">
<!-- single timeline event -->
<div class="cd-timeline-block">
<div class="cd-timeline-img cd-picture">
<img src="event-calender.png" />
</div>
<div class="cd-timeline-content">
<h2>Event 1</h2>
<p>Event 1 Description </p>
<span class="cd-date">Sunday, 19 June 2016</span>
</div>
</div>
</section>