I have a <div>
which contains a background image, the <div>
sits within a toolbar in HTML.
HTML:
<div id="toolbar">
<div class="image"> </div>
</div>
CSS:
#toolbar .image {
background url('images/logo.png') no-repeat top left;
}
#toolbar .imagehover {
background url('images/logoHover.png') no-repeat top left;
}
When the mouse hovers over #toolbar
I want the background image of .image
to change but using .fadeOut()
and .fadeIn()
So far I have:
$("#toolbar").hover(function () {
$(".image").fadeOut("slow");
$(".image").addClass("imagehover");
$(".imagehover").fadeIn("slow");
},
function () {
$(this).removeClass("imagehover");
});
Currently the logo fades out and the hover logo fades in twice.
Any help appreciated.