I want to animate an element only when this element is loaded ( with the background ). I tryed this but doesn't work:
CSS:
#topimg{
background: rgba(0, 0, 0, 0) url(../img/bg.jpg) 0 0 no-repeat fixed;
background-size: cover;
}
HTML:
<div id="topimg"> </div>
JAVASCRIPT:
$('#topimg').load(function() {
$('#topimg').css({opacity: 0}).animate({opacity: 1}, {duration: 1500});
});