Nathanwoodburn.github.io/404M.js

20 lines
483 B
JavaScript
Raw Normal View History

2020-11-24 10:54:25 +11:00
//based on https://dribbble.com/shots/3913847-404-page
var pageX = $(document).width();
var pageY = $(document).height();
var mouseY=0;
var mouseX=0;
$(document).mousemove(function( event ) {
//verticalAxis
mouseY = event.pageY;
yAxis = (pageY/2-mouseY)/pageY*300;
//horizontalAxis
mouseX = event.pageX / -pageX;
xAxis = -mouseX * 100 - 100;
$('.box__ghost-eyes').css({ 'transform': 'translate('+ xAxis +'%,-'+ yAxis +'%)' });
//console.log('X: ' + xAxis);
});