Skip to content

Instantly share code, notes, and snippets.

@SgtPooki
Created April 11, 2015 05:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SgtPooki/4506e89012250fb0e674 to your computer and use it in GitHub Desktop.
Save SgtPooki/4506e89012250fb0e674 to your computer and use it in GitHub Desktop.
Display mouse coordinates
(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'
});
});
}());
@SgtPooki
Copy link
Author

Annoyed, and also found http://stackoverflow.com/a/29574348/592760. Two birds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment