I am trying to animate an img within a div by adding a class, what am I doing wrong?
Thanks.
Please see my JSfiddle.
CODE:
HTML
<div class="loader"></div>
<div class="searchWrapper">
<div class="row">
<div class="col-xs-3">
<img src="http://images.hayneedle.com/mgen/master:AMD010.jpg?is=70,70,0xffffff">
</div>
</div>
CSS
.searchWrapper div > img {
opacity: 0;
position: relative;
}
.animate-opacity {
transition: opacity 8s;
opacity: 1;
position: relative;
}
JS
function init() {
$(".searchWrapper div > img").addClass('animate-opacity', function() {
console.log('Animation complete.');
});
}
init();
EDIT:
I jave another script which is the page loader and it's running a set interval function, maybe that's the culprit?
since i'm getting in my console starting anim but i'm NOT getting any Animation complete. from the function's callback.
Unfortuneatly on jsfiddle it's working great, but not on my computer. Jsfiddle