<div class="element" id="element"></div>
body {
  height: 100vh;
  margin: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(
    #666,
    #222
  );
}

.element {
  width: 300px;
  height: 300px;
  border: 1px solid white;
  background-image: url(https://s.7Learn.com/uploads/2018/10/big-image.jpg);
  background-size: 1000px;
}
View Compiled
const el = document.querySelector("#element");

el.addEventListener("mousemove", (e) => {
  el.style.backgroundPositionX = -e.offsetX + "px";
  el.style.backgroundPositionY = -e.offsetY + "px";
});

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.