20 lines
483 B
JavaScript
20 lines
483 B
JavaScript
//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);
|
|
|
|
}); |