Move Background image X Y axis on mouse move or hove on a div or entire body and html page (Simple Parallax)
<script>
$('html,body').mousemove(function(e){
var amountMovedX = (e.pageX * -1 / 5);
var amountMovedY = (e.pageY * -1 / 1000);
$(this).css('background-position', amountMovedX + 'px ' + amountMovedY + 'px');
});
</script>
No comments:
Post a Comment