JSFiddle - React, Tailwind, and code Playground

by surfine

HTML

<div id="s_pc" style="background-image:url(http://www.surfixe.com/img/surfixe_pc.png)"></div>
<button id="btn" style="display:none">This button should only show when image loading completes!</button>

CSS

#s_pc {
	position:absolute;
	top: 50%; right: 100px;
	margin-top: -50px;
	height: 100px; width: 100px;
	max-height: 100px; max-width: 100px;
	background-size: 100% 100%;
}

JavaScript

$('#s_pc').attr('style', 'background-image:url(www.surfixe.com/img/surfixe_pc.png)').load(function() {  
    alert('Image Loaded');
    $('#btn').show();
});