I want to make a background image disappear. It works.
But it fails when I try to delay it or to animate it.
Any guess what it’s wrong and how to do it well?
$(function(){
$("#foto1").click(function() {
$("#foto1").delay(1000).animate.css({"background":"none"},2000);
});
})
This will fadeout an image : http://jsfiddle.net/2MQeC/
— EDIT —
This will animate the background independently of the image : http://jsfiddle.net/2MQeC/1/
As you can see, this rely on CSS3 transitions for background animation.
A better cross browser solution would be to use jQuery
.animate()function.But you can’t modify as many properties as
.css()could.Extract from jQuery
.animate()documentation :However, you could change your markup and separate your image and your background in two div who are superimposed. This could simplify what you are trying to do.