views:

106

answers:

3

Hello!

Is it possible to fade in / crossfade background images please?

If so, how...

Thank you.

A: 

i'll hazard a guess and go with 'yes'.

lincolnk
+1  A: 

Hi Francisc,

A great way to do these type of effects is with jQuery.

Please take a look at:
http://api.jquery.com/fadeOut/
http://api.jquery.com/fadeIn/

The sites provide a good example of how to do each, simply apply it to your background images.

I hope this helps.

Jaime
Hi, Jamie and thank you. Question is, will that work on background images rather than <img> tags?
Francisc
Yes, absolutely. Notice in the sample codes, the html elements are referred to by their ids in jQuery. So, #someid, can reference anything (div, table, span) as long as it uses #someid. Remember now, HTML best practices mean that ids are unique, so using multiple ids will clash and the jQuery won't work. If you want your jQuery code to affect multiple divs, you can use classes, so rather than #someid, you can use .someclass in the jQuery code.
Jaime
+1  A: 

Not unless you're operating on a container (etc) that has a background image set, no. You may want to consider changing "crossfading the background of a single element" to "changing the opacities of more than one container, each of which having their own background image" - that's a more realistic approach with JS.

mway
Thank you mway.
Francisc