JSFiddle - React, Tailwind, and code Playground
HTML
<div id="header"></div>
CSS
#header {
height: 200px;
background-image: url('https://w.wallhaven.cc/full/96/wallhaven-96w8e8.png');
}
JavaScript
document.addEventListener('mousemove', function (event) {
if (window.event) { // IE fix
event = window.event;
}
// Grab the mouse's X-position.
var mousex = event.clientX;
const mousey = event.clientY;
var header = document.getElementById('header');
header.style.backgroundPosition = mousex/3 + 'px ' + mousey/3 + 'px';
}, false);