Last active
May 27, 2016 12:52
-
-
Save marcusshepp/2368554f2615b4a1b1505099a12e61af to your computer and use it in GitHub Desktop.
Javascript Element Follows Mouse Movement
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// <div class="foo">I follow</div> | |
window.addEventListener("mousemove", function(e){ | |
$(".foo").css({ | |
left: (e.pageX - ($(window).width() * .35)), | |
top: (e.pageY - 600) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment