JSFiddle - React, Tailwind, and code Playground
HTML
<div id="slideshow"><img class="active" src="http://i.imgur.com/tqMy9wn.png" alt="" /><img src="http://i.imgur.com/vNyEFB0.png" alt="" />
<div id="slideshadow"> </div>
</div>
CSS
#slideshow {
position:relative;
float:left;
height:245px;
width:200px;
}
#slideshow IMG {
position:absolute;
top:0;
left:0;
z-index:8;
opacity:0.0;
}
#slideshow IMG.active {
z-index:10;
opacity:1.0;
}
#slideshow IMG.last-active {
z-index:9;
}
#slideshadow {
position:absolute;
height:245px;
width:200px;
box-shadow:inset 0px 0px 80px 0px rgba(0,0,0,0.75);
z-index:15;
}
JavaScript
function slideSwitch() {
var $active = $('#slideshow IMG.active');
if ($active.length == 0) $active = $('#slideshow IMG:last');
var $next = $active.next('img').length ? $active.next('img') : $('#slideshow IMG:first');
$active.addClass('last-active');
$active.animate({
opacity: 0.0
}, 2000);
$next.css({
opacity: 0.0
})
.addClass('active')
.animate({
opacity: 1.0
}, 2000, function () {
$active.removeClass('active last-active');
});
}
$(function () {
setInterval(slideSwitch, 7000);
});