JSFiddle - React, Tailwind, and code Playground
HTML
<div class="wrapper">
<img src="" alt="qwe">
</div>
<div class="light">
<img src="http://www.cruzo.net/user/images/k/ecc3ecf42c75db1ffce5d06cbe95b1e6_644.jpg" alt="modal">// атрибут src не пуст
</div>
CSS
.wrapper img {
height: 100px;
width: 100px;
}
.light{
height: 100px;
width: 100px;
background: red;
visibility: hidden;
}
.light img{
height: 50px;
width: 50px;
opacity: 0;
transition: all 4s;
}
.open.light img{
height: 50px;
width: 50px;
opacity: 1;
}
.light.open{
visibility:visible;
}
JavaScript
$(document).ready(function() {
$('.wrapper img').click(function() {
$('.light').addClass('open');
$('.open img').attr('src', 'http://www.sunhome.ru/i/cards/39/prazdnik-den-zemli-kartinka.orig.jpg');
});
$('.light').click(function() {
$(this).removeClass('open')
});
});