Skip to content Skip to sidebar Skip to footer

How To Make Html/css Slideshow Background Fade?

I was wondering how you make a background slideshow fade into other photos like a regular slideshow. I've tried many codes and have yet to be successful. Now, I have a code to make

Solution 1:

Working example on jsFiddle.

Use this code instead: (note that you'll need to load jQuery in order for this code to work)

HTML

<divclass="fadein"><imgsrc="http://farm9.staticflickr.com/8359/8450229021_9d660578b4_n.jpg"><imgsrc="http://farm9.staticflickr.com/8510/8452880627_0e673b24d8_n.jpg"><imgsrc="http://farm9.staticflickr.com/8108/8456552856_a843b7a5e1_n.jpg"><imgsrc="http://farm9.staticflickr.com/8230/8457936603_f2c8f48691_n.jpg"><imgsrc="http://farm9.staticflickr.com/8329/8447290659_02c4765928_n.jpg"></div>

CSS

.fadein {
    position:relative;
    height:320px;
    width:320px;
}

.fadeinimg {
    position:absolute;
    left:0;
    top:0;
}

JavaScript

<scriptsrc="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script><scripttype="text/javascript">
$(function() {
$('.fadein img:gt(0)').hide();

setInterval(function () {
    $('.fadein :first-child').fadeOut()
                             .next('img')
                             .fadeIn()
                             .end()
                             .appendTo('.fadein');
}, 4000); // 4 seconds
});
</script>

Solution 2:

Inside the Css:

width: 100%; height: 100%; position: fixed;

Post a Comment for "How To Make Html/css Slideshow Background Fade?"