JSFiddle - React, Tailwind, and code Playground

HTML

<p class="btn"><a href="#">Click here</a></p>

<div class="box"><img src="http://www.drinkrecipeseeker.com/wp-content/uploads/2011/11/Pina-Colada-150x150.jpg"></div>

CSS

.box {
    display: block;
    width:200px;
    height:200px;
    background-color: #185277;
    position: relative;
}

.box img {

}

JavaScript

$(".btn a").click(function () {
    var boxleft = $('.box').outerWidth()/2;
    var boxtop  = $('.box').outerHeight()/2;
    var imgleft = $('.box img').outerWidth()/2;
    var imgtop  = $('.box img').outerHeight()/2;
    $('.box').animate({
        'opacity' : 0,
        'width': 0, 
        'height': 0,
        'left': boxleft + 'px',
        'top': boxtop + 'px'
    });
    $('.box img').animate({
        'opacity' : 0,
        'width': 0, 
        'height': 0,
        'left': imgleft + 'px',
        'top': imgtop + 'px'
    });
});