I have this html:
<div class='rightTile' >
<img class='bigFace' src='content/images/teamSlide/zdjecie-Basia.png'>
</div>
and I use this jQuery code to fadeout/fadein images:
$('.someElement').on('click', function(){
$('.bigFace').fadeOut('fast', function(){
$('.bigFace').attr('src', anotherPicPath).fadeIn();
});
});
I have many elements with 'someElement' class and in data-src attribue they have different images sources. The problem is, that when I first click on particular element with class someElement:
- current bigFace image fadesOut
- than fadesIn (with the same source)
- and than image changes for the one with new src
When I click on that same element again, ex. for the second time, it works perfectly:
- current bigFace image fadesOut,
- than img with swapped source fadesIn.
I thought it may be something related with images preloading so I preload them with CSS, but it gives me nothing. As a forceful, test method I even triggered click on every .someElement element, but it still gives no effects.
It only happens when I upload code to external server (production lets say). On localhost - everything s fine.
I dont know why s that. Please help:) Greetings!