I want to change image source using jQuery but with animation.
I have a default straight looking image. I have 5 different images with a head looking at different directions.
on hover of a particular section, I want to change the image to that particular image src
value.
If no div is hovered, the default straight looking image should appear.
I have achieved it but the images should change with an animation. My animations are flickering.
Can someone point me in the right direction?
$('#thumbs img').hover(function(event) {
$(this).fadeOut(100, function() {
var thisSRC = $(this).attr('src');
$('#main').attr('src', thisSRC);
}).fadeIn(100);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="thumbs">
<img src="https://i.ibb.co/rxX8VMq/left.png" width="50" height="50">
<img src="https://i.ibb.co/r77CrCC/topleft.png" width="50" height="50">
<img src="https://i.ibb.co/CzRdRtp/top.png" width="50" height="50">
<img src="https://i.ibb.co/L8cSs3p/topright.png" width="50" height="50">
<img src="https://i.ibb.co/D1cjqfD/right.png" width="50" height="50">
</div>
<img id="main" src="https://i.ibb.co/3dMWhqV/default-head.png">