JSFiddle - React, Tailwind, and code Playground

by Adhik Bagul

HTML

<body>
    <div style="color:red;">Some random text here</div>
    <input type="button" id="btnBack" value="Toggle Background" />
</body>

CSS

.BgClass {
    background-image: url('http://freedomwallpaper.com/wallpaper2/funky-wallpaper-hd.jpg');
    background-size: cover; 
    background-repeat: no-repeat;  
    background-attachment: fixed
}

JavaScript

var btnBack = document.getElementById('btnBack');
btnBack.addEventListener('click',function() {
    document.body.classList.toggle('BgClass');
});