JSFiddle - React, Tailwind, and code Playground
HTML
<!-- For Actual Image -->
<div class='act_img'>
<img src="http://www.ipad-wallpapers.us/bgs/nature-field-ipad-background-h.jpg" width="200" height="200">
<img src="http://crackphone.com/uploads/2010/04/iPadWallpaperNature18_thumb.jpg" width="200" height="200" style='display: none;'>
</div>
<br /><br />
<!-- For Backgroun Image -->
<div class='bg_test'></div>
CSS
div {
width : 200px;
height : 200px;
background-color: black;
position: relative;
}
div img {
position: absolute;
left: 0;
top: 0;
}
.bg_test {
background: url(http://www.ipad-wallpapers.us/bgs/nature-field-ipad-background-h.jpg) center center no-repeat;
}
JavaScript
function do_toggle() {
setTimeout(function() {
$('.act_img img').fadeToggle();
//Re-call function if you want infinit repeat.
do_toggle();
}, 3000);
}
$(function() {
do_toggle();
//call background change
setTimeout(function() {
$('.bg_test').css({
backgroundImage : 'url(http://crackphone.com/uploads/2010/04/iPadWallpaperNature18_thumb.jpg)',
backgroundPosition : 'center center',
backgroundRepeat : 'no-repeat'
});
}, 3000);
});