forked from dotjay/hashgrid
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.htm
375 lines (319 loc) · 10.4 KB
/
index.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>#grid</title>
<style type="text/css">
/* Putting inline rules here so the document can be downloaded with style */
body{
font-size: 1em;
line-height: 1.25;
font-family: Arial, sans-serif;
background: White;
color: DimGray;
margin: 0;
padding: 0 20px;
}
#content{
font-size: 16px;
line-height: 20px;
position: relative;
}
#content{
width: 620px;
margin: 0 auto;
}
#footer{
border-top: 1px dotted DarkGray;
padding-top: 19px;
}
h1, h2{
color: Black;
font-weight: normal;
}
h1{
font-size: 36px;
line-height: 40px;
margin: 40px 0 20px;
padding-bottom: 19px;
border-bottom: 1px dotted DarkGray;
}
h1 em{
font-style: normal;
color: DarkGray;
font-size: 16px;
line-height: 20px;
margin: 0 0 20px;
}
h2, h3{
font-size: 16px;
font-weight: 700;
line-height: 20px;
margin: 0 0 20px;
}
h3{
font-weight: 300;
}
a:link,
a:visited{
color: Black;
text-decoration: none;
padding: 0 2px;
background-color: WhiteSmoke;
border-bottom: 1px solid Gold;
}
a:focus{
outline: none;
}
a:focus,
a:hover,
a:active{
background-color: Khaki;
border-bottom: 1px solid GoldenRod;
}
p, ul{
padding: 0;
margin: 0 0 20px;
}
dl, ol{
padding: 0;
margin: 0;
}
ul{
list-style: circle;
}
ol li{
margin-bottom: 20px;
}
dd{
margin: 0 0 20px 0;
}
del{
text-decoration: line-through;
opacity: 0.75;
}
ins{
text-decoration: none;
}
code{
font-size: 14px;
line-height: 1;
}
textarea{
font-family: 'Courier New', monospace;
font-size: 14px;
line-height: 20px;
display: block;
width: 600px;
margin: 0 0 20px;
padding: 0 0 0 15px;
border: 0;
color: Black;
background: Gainsboro;
border-left: 5px solid DarkGray;
}
#javascript-code{
height: 180px;
}
#css-code{
height: 1300px;
}
.summary em{
font-style: normal;
position: absolute;
color: DarkGray;
right: 0;
top: 18px;
width: 140px;
}
.summary em span{
position: absolute;
left: -9999px;
}
#download{
line-height: 60px;
padding: 0 40px 0 15px;
border-left: 5px solid DarkGray;
background: Gainsboro;
color: DimGray;
}
span.key{
color: Black;
text-transform: uppercase;
}
</style>
<!-- Set styles -->
<style type="text/css">
/**
* Grid
*/
#grid{
/* Vertical grid lines */
background: url(bg-grid-980.gif) repeat-y 0 0;
/* Dimensions - same width as your grid with gutters */
width: 980px;
/* Grid (left-aligned)
position: absolute;
top: 0;
left: 0;
*/
/* Grid (centered) */
position: absolute;
top: 0;
left: 50%;
margin-left: -490px;
}
/**
* Classes for multiple grids
*
* When using more than one grid, remember to set the numberOfGrids
* option in the hashgrid.js file.
*/
#grid.grid-1{
/* Vertical grid lines for grid 1 */
background: url(bg-grid-980.gif) repeat-y 0 0;
}
#grid.grid-2{
/* Vertical grid lines for grid 2 */
background: url(bg-grid-660.gif) repeat-y 160px 0;
/* Adjustments */
padding: 0 160px;
width: 660px;
}
/**
* Horizontal grid lines, defined by your base line height
*
* Remember, the CSS properties that define the box model:
* visible height = height + borders + margins + padding
*/
#grid div.horiz{
/* 20px line height */
height: 19px;
border-bottom: 1px dotted #aaa;
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div id="content" role="main">
<h1>#grid <em>v4</em></h1>
<p class="summary"><em>Mon, 29 Mar 2010<span>:</span></em> This is a little tool we created for our <a href="http://analog.coop/">Analog holding page</a>. It inserts a <a href="http://en.wikipedia.org/wiki/Grid_(page_layout)">layout grid</a> 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 <span class="key">G</span> on your keyboard.</p>
<h2>Download</h2>
<p id="download"><a href="http://github.com/dotjay/hashgrid/downloads">Download #grid</a> from <a href="http://github.com/dotjay/hashgrid">GitHub</a></p>
<h2 id="features">Features</h2>
<ul>
<li>Adaptable for all layout widths and alignments</li>
<li>Adaptable for any vertical rhythm value</li>
<li>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</li>
<li>Uses a single JavaScript file, a little CSS, and an image (for the vertical lines)</li>
</ul>
<p>#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.</p>
<h2 id="installation">Installation</h2>
<ol>
<li><h3>Copy the <a href="http://github.com/dotjay/hashgrid/blob/master/hashgrid.js">hashgrid.js</a> script to your project</h3></li>
<li><h3>Add the script to your page(s) just inside the <code></body></code> tag</h3>
<textarea id="javascript-code" cols="68" rows="8" readonly="readonly">
<!-- Grab latest version of jQuery -->
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">
</script>
<!-- Include the hashgrid script -->
<script type="text/javascript" src="hashgrid.js"></script></textarea></li>
<li><h3>Add the CSS to your page(s)</h3>
<textarea id="css-code" cols="68" rows="64" readonly="readonly">
/**
* Grid
*/
#grid{
/* Vertical grid lines */
background: url(bg-grid-980.gif) repeat-y 0 0;
/* Dimensions - same width as your grid with gutters */
width: 980px;
/* Grid (left-aligned)
position: absolute;
top: 0;
left: 0;
*/
/* Grid (centered) */
position: absolute;
top: 0;
left: 50%;
margin-left: -490px;
}
/**
* Classes for multiple grids
*
* When using more than one grid, remember to set the numberOfGrids
* option in the hashgrid.js file.
*/
#grid.grid-1{
/* Vertical grid lines for grid 1 */
background: url(bg-grid-980.gif) repeat-y 0 0;
}
#grid.grid-2{
/* Vertical grid lines for grid 2 */
background: url(bg-grid-660.gif) repeat-y 160px 0;
/* Adjustments */
padding: 0 160px;
width: 660px;
}
/**
* Horizontal grid lines, defined by your base line height
*
* Remember, the CSS properties that define the box model:
* visible height = height + borders + margins + padding
*/
#grid div.horiz{
/* 20px line height */
height: 19px;
border-bottom: 1px dotted #aaa;
margin: 0;
padding: 0;
}
</textarea></li>
<li><h3>Modify #grid to suit your needs</h3>
<p>The CSS and JavaScript is annotated to help you. We’ve included a <a href="bg-grid-980.gif">980px-wide background image</a> to provide the vertical grid lines (a 940-pixel-wide content area with 20px gutters). If you’re working to a <a href="http://www.markboulton.co.uk/journal/comments/five-simple-steps-to-designing-grid-systems-part-1">different grid</a>, you will need to create a new image for your guides. Don’t forget to make the background transparent!</p></li>
</ol>
<h2 id="usage">Usage</h2>
<p>The document must have keyboard focus for #grid to work. You may need to click on the document background or <span class="key">TAB</span> into the page first.</p>
<dl>
<dt><span class="key">G</span></dt>
<dd>Show the grid until you release.</dd>
<dt><span class="key">G</span> + <span class="key">H</span></dt>
<dd>Show and hold the grid (<span class="key">G</span> will remove it again).</dd>
<dt><span class="key">G</span> + <span class="key">F</span></dt>
<dd>Toggle the grid to the foreground and back. Pressing <span class="key">F</span> while the grid is held also works.</dd>
<dt><span class="key">G</span> + <span class="key">J</span></dt>
<dd>Jump to the next grid. Pressing <span class="key">J</span> while the grid is held also works.</dd>
</dl>
<p><em>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.</em></p>
<h2 id="release-notes">Release Notes</h2>
<dl>
<dt>v4 — 29 Mar 2010</dt>
<dd>Fixes for multiple grid support under WebKit (Safari and Chrome).</dd>
<dt>v3 — 22 Feb 2010</dt>
<dd>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 <a href="#usage">Usage</a>). Using <span class="key">CTRL</span>, <span class="key">ALT</span> or <span class="key">SHIFT</span> as a modifier key is now optional. Keys no longer show or affect the grid while typing in forms.</dd>
<dt>v2 — 2 Feb 2010</dt>
<dd>Keys are now more easily configured (see top of hashgrid.js). Renamed the GridOverlay object to hashgrid. Fixed crash when using with disabled CSS.</dd>
<dt>v1 — 21 Dec 2009</dt>
<dd>First release.</dd>
</dl>
<h2 id="known-issues">Known Issues</h2>
<ul>
<li><del>IE 8: Fully functional, but the default <span class="key">ALT</span> + <span class="key">G</span> + <span class="key">ENTER</span> shortcut puts IE into full screen mode. Hit <span class="key">ALT</span> + <span class="key">ENTER</span> to toggle full screen mode off again.</del><ins datetime="2010-02-22"> The default keyboard shortcuts have been changed.</ins></li>
<li>IE 6: The grid is always in the foreground.</li>
<li>Opera 9/10: Using <span class="key">CTRL</span> or <span class="key">ALT</span> as a modifier key will not work due to different key handling by the browser.</li>
</ul>
<h2 id="license">License</h2>
<p>Released under a <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike License</a>, which essentially means that you’re free to copy it and adapt it. <a href="http://analog.coop/#talk-to-us">Contact us at Analog</a> if you need a different license.</p>
<div id="footer" role="contentinfo">
<p>#grid is an <a href="http://analog.coop/">Analog</a> gig. It was conceived by <a href="http://jontangerine.com/">Jon Tan</a>, and built by <a href="http://accessibility.co.uk/">Jon Gibbins</a>, in cahoots with our <a href="http://analog.coop#is">fine friends</a>. Oh, and the CSS for this page playfully uses <a href="http://www.w3.org/TR/css3-color/#svg-color">SVG colour keywords</a> only.</p>
</div>
</div>
<!-- Grab latest version of Prototype -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js"></script>
<!-- Include the hashgrid script -->
<script type="text/javascript" src="hashgrid.js"></script>
</body>
</html>