JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
CSS
body {
background-image: url('https://avatars.githubusercontent.com/u/11070389?v=3');
background-repeat: no-repeat;
}
JavaScript
var url = $('body').css('background-image').replace('url(', '').replace(')', '').replace("'", '').replace('"', '');
var bgImg = $('<img />');
var bodyHeight = $('body').height();
var bodyWidth = $('body').width();
bgImg.hide();
bgImg.bind('load', function()
{
var imgHeight = $(this).height();
var imgWidth = $(this).width();
alert("Body height: " + bodyHeight + "px, Body width: " + bodyWidth + "px");
alert("Image height: " + imgHeight + "px, Image width: " + imgWidth + "px");
});
$('body').append(bgImg);
bgImg.attr('src', url);