tags:

views:

61

answers:

1

Once the page has finished loading, I would like one image to cross-fade to another. Not in a loop, just once.

The effect I would like to create can be seen here:

Blur Fade

I am sure it must be quite simple using jQuery?

Thanks in advance

A: 

You can crossfade between two images by positioning them in the same place using CSS, then calling fadeIn() and fadeOut() using jQuery.

For example:

$(function() {
    $('img.OldImage').fadeOut();
    $('img.NewImage').fadeIn();
});
SLaks
Could I use fadeTo?
Anthony
@Anthony: Yes, but it won't be any different.
SLaks
@SLaksTo expand on my comment above, could I use fadeTo() as I am only using two images?Have the two images absolutely positioned one on top of the other using CSS and fade the top image to opacity 0? $(document).ready(function () { $('img.TopImage').delay(500).fadeTo('normal',0); });Is this correct? Would this apply to the image with the class .TopImage applied to it?
Anthony
Yes, but that's equaivalent to `fadeIn()`.
SLaks