<html>
<head>
</head>
<div class="product-gallery">
<img src="/i/catalog/1.png" width="400" height="400" >
</div>
<a href="#"><img src="/i/catalog/1.png"></a>
<a href="#"><img src="/i/catalog/2.png"></a>
<a href="#"><img src="/i/catalog/3.png"></a>
<a href="#"><img src="/i/catalog/4.png"></a>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$('a > img').click(function(e){
e.preventDefault();
var el = this;
$('.product-gallery>img').fadeOut("slow", function() {
$(this).fadeIn("slow", "linear").attr('src', el.src);
});
});
</script>
</body>
</html>