Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container">
<h1>jQuery Animated multiple Background Images of &lt;body&gt; with Fade-in &amp; Fade-out Effects</h1>
<h2>Here's a quick example of multiple images fading one after the other.</h2>

<p>"How to change multiple background-image of body with effects?" - I think this is a major problem which all designers face. You can fade background colors but not background images. The way to work around this is to have your images as <code>&lt;img&gt;</code> tags and hide them by default display:none;. Give your images position:absolute and z-index:-1 so they act like backgrounds and are behind everything else.</p>
<p>Enjoy this demo.. and now you can say "Wooh..!! It's too easy to animate multiple background-image css property in body tag."</p>
<p><a href="http://www.css-jquery-design.com/2013/05/05/jquery-animate-full-page-multiple-background-image-fade-in-out-effect/" target="_blank">&laquo; Back To Article</a></p>
</div>

<div id="wrap">
<img class="bgfade" src="http://farm9.staticflickr.com/8526/8668341950_182b74faf2_z.jpg">
<img class="bgfade" src="http://farm9.staticflickr.com/8532/8667337535_6da0a9a261_z.jpg">
<img class="bgfade" src="http://farm9.staticflickr.com/8540/8667244539_d227f8c435_z.jpg">
</div>
              
            
!

CSS

              
                @import url(https://fonts.googleapis.com/css?family=Cherry+Swash);
body, html{
    margin:0;
    padding:0;
    color:#222;
	font-family: 'Cherry Swash', trebuchet ms, cursive; 
	font-size:1.5em
}
a{color:#930; text-decoration:none}
#wrap{
	position:fixed;; 
	z-index:-1; 
	top:0; 
	left:0; 
	background-color:black
}
#wrap img.bgfade{
    position:absolute;
    top:0;
    display:none;
    width:100%;
    height:100%;
	z-index:-1
}
.container{
	width:80%; 
	margin:20px auto; 
	margin-top:25%; 
	background:#fff; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; 
	background-color:rgba(255,255,255,.7); 
	padding:1em; 
	border-radius:15px; 
	box-shadow:4px 4px 10px 0 rgba(20,20,20,.6); 
	text-shadow: 1px 1px 5px #fff
}
              
            
!

JS

              
                $(window).load(function(){
$('img.bgfade').hide();
var dg_H = $(window).height();
var dg_W = $(window).width();
$('#wrap').css({'height':dg_H,'width':dg_W});
function anim() {
    $("#wrap img.bgfade").first().appendTo('#wrap').fadeOut(1500);
    $("#wrap img").first().fadeIn(1500);
    setTimeout(anim, 3000);
}
anim();})
$(window).resize(function(){window.location.href=window.location.href})
              
            
!
999px

Console