Skip to content

Instantly share code, notes, and snippets.

@jgarber623
Created July 20, 2010 02:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgarber623/482398 to your computer and use it in GitHub Desktop.
Save jgarber623/482398 to your computer and use it in GitHub Desktop.
Grid Helper bookmarklet for web development
javascript:(function() {
if ( !document.getElementById( "__grid" ) ) {
d = document.createElement( "div" );
d.setAttribute( "id", "__grid" );
d.setAttribute( "style", "background: url('http://" + window.location.hostname + "/images/grid.png') repeat-y 50% 0; height: " + document.height + "px; left: 0; position: absolute; top: 0; width: 100%; z-index: 16000000;" );
document.body.appendChild( d );
} else {
document.body.removeChild( document.getElementById( "__grid" ) );
}
})();
@jgarber623
Copy link
Author

This one's pretty easy to use:

  1. Save this code as a bookmarklet in your favorite browser.
  2. Drop a "grid.png" file into your-site-root/images/.
  3. Click the bookmarklet to add the grid overlay.
  4. Click the bookmarklet again to remove the grid overlay.

This code works best when you're running a Rails app or something similar where ~/images is off the root (e.g. http://localhost:3000/images/). Feel free to modify this to your heart's content.

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