вторник, 6 апреля 2010 г.

#grid v4

This is a little tool we created for our Analog holding page. It inserts a layout grid in web pages, allows you to hold it in place, and toggle between displaying it in the foreground or background. To see it in action, hit G on your keyboard.

Download

Features

  • Adaptable for all layout widths and alignments
  • Adaptable for any vertical rhythm value
  • Set keyboard shortcuts to show and hide the grid, hold it in place, toggle it to the foreground and background, and jump between multiple grids
  • Uses a single JavaScript file, a little CSS, and an image (for the vertical lines)
#grid comes set up with a 980px-wide container that includes 20px gutters, and assumes one lead of 20px. A second 660px-wide container is included to show you how to set up multiple grids.

Installation

  1. Copy the hashgrid.js script to your project

  2. Add the script to your page(s) just inside the </body> tag

  3. Add the CSS to your page(s)

  4. Modify #grid to suit your needs

    The CSS and JavaScript is annotated to help you. We’ve included a 980px-wide background image to provide the vertical grid lines (a 940-pixel-wide content area with 20px gutters). If you’re working to a different grid, you will need to create a new image for your guides. Don’t forget to make the background transparent!

Usage

The document must have keyboard focus for #grid to work. You may need to click on the document background or TAB into the page first.
G
Show the grid until you release.
G + H
Show and hold the grid (G will remove it again).
G + F
Toggle the grid to the foreground and back. Pressing F while the grid is held also works.
G + J
Jump to the next grid. Pressing J while the grid is held also works.
N.B. A cookie conveniently remembers the state of the grid when you refresh the page. While the grid is in front, you will not be able to interact with the page.

Release Notes

v4 — 29 Mar 2010
Fixes for multiple grid support under WebKit (Safari and Chrome).
v3 — 22 Feb 2010
Multiple grids can be set up and cycled through at a key press. To avoid keyboard shortcut conflicts, the default keys have been changed (see Usage). Using CTRLALT or SHIFTas a modifier key is now optional. Keys no longer show or affect the grid while typing in forms.
v2 — 2 Feb 2010
Keys are now more easily configured (see top of hashgrid.js). Renamed the GridOverlay object to hashgrid. Fixed crash when using with disabled CSS.
v1 — 21 Dec 2009
First release.

Known Issues

  • IE 8: Fully functional, but the default ALT + G + ENTER shortcut puts IE into full screen mode. Hit ALT + ENTER to toggle full screen mode off again. The default keyboard shortcuts have been changed.
  • IE 6: The grid is always in the foreground.
  • Opera 9/10: Using CTRL or ALT as a modifier key will not work due to different key handling by the browser.

License

Released under a Creative Commons Attribution-Share Alike License, which essentially means that you’re free to copy it and adapt it. Contact us at Analog if you need a different license.

Комментариев нет:

Отправить комментарий