Created
April 4, 2016 02:57
-
-
Save jbrz0/ca4e5371e76202962e6ca462fae8d502 to your computer and use it in GitHub Desktop.
jQuery horizontal background w/ cursor
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
$(window).mousemove(function (e) { | |
var mousePosX = (e.pageX / $(window).width()) * 100; | |
var mousePosY = (e.pageY / $(window).height()) * 100; | |
// console.log(mousePosY) | |
$('.thumbs-block').css('backgroundPosition', mousePosX + '% ' + mousePosY +'%'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment