JSFiddle - React, Tailwind, and code Playground

HTML

<div class="fotowind shadow"></div>

CSS

html, body {
    height: 100%;
}

.fotowind {
    background-image: url(http://www.insidegraphics.com/flash_mask/images/flash_tools_image.jpg);
    background-position: center center;
    background-repeat: no-repeat;
    height: 100%;
}

JavaScript

$(window).on('resize', function() {
    if($(window).width() < 300) {
        $('div.fotowind').css('background-size', '100% auto');
    } else if($(window).height() < 300) {
        $('div.fotowind').css('background-size', 'auto 100%');
    } else {
        $('div.fotowind').css('background-size', 'auto');
    }
});