Trying to mimic Squarespace's current background effect where it follows the motion of your mouse
A Pen by Josh Black on CodePen.
<!-- <3 Angelina Fabbro --> | |
<img src="http://farm9.staticflickr.com/8189/8148307537_7756003b1c_o.jpg"> |
var $img = $('img'); | |
$img.on('mousemove', function(event) { | |
var styles = { | |
'-webkit-transform': 'translate3d(' + (event.pageX / -128) + 'px,' + (event.pageY / -128) + 'px,0)', | |
'-moz-transform': 'translate3d(' + (event.pageX / -128) + 'px,' + (event.pageY / -128) + 'px,0)', | |
'-o-transform': 'translate3d(' + (event.pageX / -128) + 'px,' + (event.pageY / -128) + 'px,0)', | |
'transform': 'translate3d(' + (event.pageX / -128) + 'px,' + (event.pageY / -128) + 'px,0)' | |
}; | |
$img.css(styles); | |
}); |
Trying to mimic Squarespace's current background effect where it follows the motion of your mouse
A Pen by Josh Black on CodePen.
body { | |
margin: 0; | |
} | |
img { | |
min-height: 100%; | |
min-width: 1024px; | |
width: 105%; | |
height: auto; | |
position: fixed; | |
top: -50px; | |
left: -50px; | |
} |