Created
April 11, 2015 05:04
-
-
Save SgtPooki/4506e89012250fb0e674 to your computer and use it in GitHub Desktop.
Display mouse coordinates
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
(function() { | |
'use strict'; | |
var $toolTip = $('<div/>'); | |
$toolTip.addClass('customTooltip-rsd') | |
.css({ | |
position: 'absolute', | |
display: 'inline-block', | |
'font-size': '22px', | |
backgroundColor: '#000', | |
color: '#ffffff', | |
'z-index': 9999999999, | |
padding: '10px', | |
'word-spacing': '10px', | |
'border-radius': '50%', | |
width: 100, | |
height: 100, | |
'line-height': '100px', | |
'text-align': 'center', | |
'font-weight': 'bold' | |
}) | |
; | |
$(document.body).append($toolTip); | |
$(window).on('mousemove', function(e) { | |
var posX = e.pageX; | |
var posY = e.pageY; | |
$toolTip.text(posX + ',' + posY).css({ | |
top: posY + 'px', | |
left: posX + 'px' | |
}); | |
}); | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Annoyed, and also found http://stackoverflow.com/a/29574348/592760. Two birds.