I'll go through code's main parts for more explanation.
HTML
<div class="wrapper">
<div class="inner">
<!-- images go here -->
</div>
</div>
CSS
-
Wrapper - height and width should be adjusted to your need:
.wrapper {
overflow: hidden;
position: relative;
height: 200px;
width: 400px;
margin: 0 auto;
}
-
Inner wrapper - To append images to:
.inner {
height: 200px;
width: auto;
position: absolute;
left: 0;
white-space: nowrap;
}
-
Transition wrappers - Used for images transition in and out:
.holder, .in, .hidden {
position: absolute;
}
-
Hide preloaded images:
.hidden {
display: none;
}