10 lines
384 B
JavaScript
10 lines
384 B
JavaScript
(function() {
|
|
var background = document.getElementById('background');
|
|
|
|
window.addEventListener('mousemove', function (event) {
|
|
var newX = (event.clientX / document.body.clientWidth * 2 - 1);
|
|
var newY = (event.clientY / document.body.clientHeight * 2 - 1);
|
|
background.style.top = -newY + "vh";
|
|
background.style.left = -newX + "vw";
|
|
})
|
|
})();
|