Skip to content

Instantly share code, notes, and snippets.

@macabreb0b
Last active August 29, 2015 14:08
Show Gist options
  • Save macabreb0b/4b9ce9369d3b3d7ab99b to your computer and use it in GitHub Desktop.
Save macabreb0b/4b9ce9369d3b3d7ab99b to your computer and use it in GitHub Desktop.
Click anywhere on your page to show crosshairs that reveal the vertical + horizontal midpoint.
$(function() {
$('body').one('click', function(event) {
var halfHeight = window.innerHeight / 2;
var halfWidth = window.innerWidth / 2;
var horizontalRule = $('<div style="width: 100%; height: ' + halfHeight + 'px; border: 0; border-bottom: thin solid blue; position: absolute; top:0;left:0"></div>');
var verticalRule = $('<div style="width: ' + halfWidth + 'px; height: 100%; border: 0; border-right: thin solid blue; position: absolute; top:0;left:0"></div>');
$('body').append(horizontalRule);
$('body').append(verticalRule);
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment