I have a background image that I want to fade in and out. So I use jQuery fadeIn and fadeOut for my wrapper div. The problem is the wrapper div has my sidebar and navigation as position:absolute within the wrapper div, and they also fade in and out with the background image of the wrapper div. Here is the code (which doesn't work. It fades everything.):
HTML:
<div class="wrapper">
<div class="main">
<div class="navigation"></div>
<div class="sidebar"></div>
</div>
</div>
CSS:
.wrapper {
position:relative;
}
.navigation {
position:absolute;
top:80px;
left:200px;
}
.sidebar {
position:absolute;
top: 80px;
right: 200px;
}
JavaScript:
var wrapper = $(".wrapper").not(".sidebar, .navigation");
wrapper.fadeOut(2000, function () {
wrapper.css("background", "url(" + image + ")");
wrapper.fadeIn(2000);
});
<div>just for the background image and position it absolutely underneath with 100% width and height and fade that div ? - Joel Almeidawrapper? Make acontainerthat haswrapperinside andmainas child controls. And fadewrapperindependently - Kirill Slatin