JSFiddle - React, Tailwind, and code Playground
by Mohamed Amer
HTML
<div class="no-class"></div>
CSS
.no-class {
height: 500px;
width:500px;
background-color: red;
}
.background-image {
background-image: url('http://www.gettyimages.co.uk/gi-resources/images/HomepageCurationTiles/CREATIVE/02NOV2015/Nature-535657961.jpg');
background-size: 100% 100%;
background-color: blue;
}
JavaScript
$(document).ready(function () {
$('.no-class').click(function() {
$('.no-class').toggleClass('background-image');
});
})