Skip to content

Instantly share code, notes, and snippets.

@cballenar
Created October 21, 2013 04:32
Show Gist options
  • Select an option

  • Save cballenar/7078684 to your computer and use it in GitHub Desktop.

Select an option

Save cballenar/7078684 to your computer and use it in GitHub Desktop.
In-browser Photoshop-like guides. After designing in browser for a little while there's been a few times that I wished I had guides in the browser so I decided to see how this worked out. Test page: http://jsbin.com/uHujOyo/3/edit
.guides {
div {
cursor: move;
content: ' ';
display: block;
position: fixed; }
#x {
top: 50%;
width: 100%; height: 1px;
background: cyan; }
#y {
left: 50%;
height: 100%; width: 1px;
background: cyan; } }
// Guides
// Requires jQuery & jQuery UI (draggable)
$('body').append('<div class="guides"><div id="x"></div><div id="y"></div></div>');
$('#x').draggable({ axis: 'y' });
$('#y').draggable({ axis: 'x' });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment