JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<div class="row-fluid">
<div class="col-xs-12">
	<h2 class="theWidth"></h2>
	Change the viewport width and rerun.<hr />
		<table>
      <tr>
        <th></th>
        <th>bodyWidth</th>
      </tr>
      <tr id="theBody">
        <td>initial</td>
			  <td class="sm6"></td>
			  <td class="imgH"></td>
      </tr>
      <tr id="DOMready">
        <td>DOMready</td>
			  <td class="sm6"></td>
			  <td class="imgH"></td>
      </tr>
      <tr id="onLoad">
        <td>onLoad</td>
			  <td class="sm6"></td>
			  <td class="imgH"></td>
      </tr>
		</table>
</div>
</div>

CSS

.main-img {
  width: 100%;
  height: auto
}
#theContainer {
  margin-top: 15px;
}
/* body {width: 100vw;} */

table td {
  padding: 5px;
}

JavaScript

document.initPictures = function() {
  $('.resizeMe').css({
    'height': $('#theContainer .col-sm-6').eq(1).height() + 6,
    'display': 'flex',
    'flex-direction': 'column',
    'transition': 'height .4s cubic-bezier(0.55, 0, 0.55, 0.2)'
  });
  $('.resizeMe img').each(function() {
    var src = $(this).attr('src');
    $('.resizeMe').append('<div style="flex-basis: 50%; background-image: url(' + src + '); background-size:cover; background-position: center center"' + '</div>');
    $(this).remove();
  })
};
document.resizePictures = function() {
  if ($('#theContainer').outerWidth() > 768) {
    $('.resizeMe').css({
      'height': $('#theContainer .col-sm-6').eq(1).height()
    });
  } else {
    $('.resizeMe').css({
      'height': $('.resizeMe').outerWidth()
    });
  }
	$('.theWidth').text($('body').outerWidth());
};
$('.theWidth').text('body width is first: ' + $('body').outerWidth());
setTimeout(function(){
    $('.theWidth').text($('.theWidth').text() + ' and than: '+ $('body').outerWidth());
}, 1000)

var bodyWidth = $('body').width();
$('#theBody .imgH').text(bodyWidth);
console.log('initial: ' + bodyWidth);

$(document).ready(function(){
  var bodyWidth = $('body').width();
	$('#DOMready .imgH').text(bodyWidth);
  console.log('dom ready: ' + bodyWidth);
});

window.onload = function(){
  var bodyWidth = $('body').width();
	$('#onLoad .imgH').text(bodyWidth);
  console.log('onload: ' + bodyWidth);
}

$(window).resize(function() {
  document.resizePictures();
});
document.initPictures();