-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathindex.html
317 lines (302 loc) · 12.2 KB
/
index.html
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
<!DOCTYPE html><html lang="en-GB"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link rel="shortcut icon" type="image/x-icon" href="favicon.ico"><title>#grid</title>
<!-- Demo styles-->
<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: 20px 0 0 15px;
border: 0;
color: Black;
background: Gainsboro;
border-left: 5px solid DarkGray;
}
#javascript-code{
height: 300px;
}
#css-code{
height: 1560px;
}
.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>
<!-- Hashgrid styles-->
<style type="text/css">
/**
* Hashgrid
*/
#hashgrid{
/*
* Spreads the whole page by default
* Adjust to match your container
*/
/*width: 100%;*/
width: 980px;
position: absolute;
height: 100%;
top: 0;
left: 50%;
margin-left: -490px;
overflow: hidden;
}
.hashgrid-column-container {
position: absolute;
height: 100%;
width: 100%;
top: 0;
left: 0;
}
/**
* Vertical grid lines
*
* Set the column width taking the borders into consideration,
* and use margins to set column gutters.
*/
.hashgrid__column{
width: 139px;
border: solid darkturquoise;
border-width: 0 1px;
margin-left: 19px;
height: 100%;
float: left;
}
/**
* Horizontal grid lines, defined by your base line height
*
* Remember, the CSS properties that define the box model:
* visible height = height + borders + margins + padding
*/
.hashgrid__row{
/* 20px line height */
height: 19px;
border-bottom: 1px dotted darkgray;
margin: 0;
padding: 0;
}
/**
* Classes for multiple grids
*
* When using more than one grid, remember to set the numberOfGrids
* option when instantiating Hashgrid.
* e.g.
*
* var hg = new Hashgrid({
* numberOfGrids: 2
* });
*/
#hashgrid.hashgrid2,
#hashgrid.hashgrid2 .hashgrid-column-container{
/* Container width adjustments */
padding: 0 160px;
width: 660px;
}
#hashgrid.hashgrid2 .hashgrid__column{
/* Vertical grid line colour for grid 2 */
border-color: crimson;
}
</style>
</head><body><main id="content"><h1>#grid <em>v10</em></h1><p class="summary"><em>30 Nov 2015<span>:</span></em>#grid (or “Hashgrid”) is a little tool that 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="https://github.com/dotjay/hashgrid/tags">Download #grid</a> from <a href="https://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 and a little CSS to control the grid lines, columns and gutters</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="https://github.com/dotjay/hashgrid/tree/main/dist/javascripts">hashgrid.js</a> script to your project</h3></li><li><h3>Add this script to your page(s) just before the closing <code></body></code> tag</h3><textarea id="javascript-code" cols="68" rows="15" readonly="readonly"><!-- Include the Hashgrid script -->
<script type="text/javascript" src="hashgrid.js"></script>
<!-- Kick Hashgrid into action -->
<script type="text/javascript">
var grid = new Hashgrid({ numberOfGrids: 2 });
</script>
<!-- Note: Use window onload if your css is not inlined -->
<script type="text/javascript">
window.addEventListener("load", function(event) {
var grid = new Hashgrid({ numberOfGrids: 2 });
});
</script></textarea></li><li><h3>Add the CSS to your page(s)</h3><textarea id="css-code" cols="68" rows="64" readonly="readonly">/**
* Grid
*/
#hashgrid{
/*
* Spreads the whole page by default
* Adjust to match your container
*/
/*width: 100%;*/
width: 980px;
position: absolute;
height: 100%;
top: 0;
left: 50%;
margin-left: -490px;
overflow: hidden;
}
.hashgrid-column-container {
position: absolute;
height: 100%;
width: 100%;
top: 0;
left: 0;
}
/**
* Vertical grid lines
*
* Set the column width taking the borders into consideration,
* and use margins to set column gutters.
*/
.hashgrid__column{
width: 139px;
border: solid darkturquoise;
border-width: 0 1px;
margin-left: 19px;
height: 100%;
float: left;
}
/**
* Horizontal grid lines, defined by your base line height
*
* Remember, the CSS properties that define the box model:
* visible height = height + borders + margins + padding
*/
.hashgrid__row{
/* 20px line height */
height: 19px;
border-bottom: 1px dotted darkgray;
margin: 0;
padding: 0;
}
/**
* Classes for multiple grids
*
* When using more than one grid, remember to set the numberOfGrids
* option when instantiating hashgrid.
* e.g.
*
* var hg = new Hashgrid({
* numberOfGrids: 2
* });
*/
#hashgrid.hashgrid2,
#hashgrid.hashgrid2 .hashgrid-column-container{
/* Container width adjustments */
padding: 0 160px;
width: 660px;
}
#hashgrid.hashgrid2 .hashgrid__column{
/* Vertical grid line colour for grid 2 */
border-color: crimson;
}
</textarea></li><li><h3>Modify #grid to suit your needs</h3><p>The CSS and JavaScript is annotated to help you.</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>Note: Hashgrid 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>v10 — 30 Nov 2015</dt><dd>Works with vanilla JavaScript - jQuery is no longer required - thanks to <a href="https://github.com/widatama">widatama</a>.</dd><dt>v9 — 30 May 2013</dt><dd>Minor release: Improved example usage to avoid conflicts.</dd><dt>v8 — 6 Oct 2012</dt><dd><ul><li>Grid overlay can now be used inside a wrapping container with <code>position: relative;</code> rather than working inside the whole viewport. Thanks to <a href="https://www.tomarnold.de/">Tom Arnold</a>.</li><li>Holding down the #grid keys will no longer make browsers cry. Thanks to <a href="https://github.com/callumacrae">Callum Macrae</a>.</li><li>Fixes to cookie handling. Thanks to <a href="https://github.com/LoonyPandora">James Aitken</a>.</li><li>Optimisations.</li></ul></dd><dt>v7 — 11 Jun 2011</dt><dd>Minor release: Updated license references.</dd><dt>v6 — 10 Jun 2011</dt><dd>Minor release: Optimisations (thanks to <a href="https://github.com/ajaswa/">Andrew Jaswa</a> for contributions), and now released under an Apache License.</dd><dt>v5 — 3 Nov 2010</dt><dd><ul><li>Vertical grid lines can now be set using CSS… images are no longer required! Thanks to <a href="https://twitter.com/coates">Sean Coates</a> for the contribution.</li><li>Click events now interact with the page when the grid is in the foreground. Tested in WebKit and Gecko. Thanks to <a href="http://twitter.com/pdokas">Phil Dokas</a> for the tip about using the <code>pointer-events</code> CSS property.</li><li>Improved grid rendering, fixing a compatibility issue with jQuery 1.4.3. Thanks to everybody who’s given feedback.</li></ul></dd><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><ul><li>Keys are now more easily configured (see top of hashgrid.js).</li><li>Fixed crash when using with disabled CSS.</li><li>Renamed the GridOverlay object to hashgrid.</li></ul></dd><dt>v1 — 21 Dec 2009</dt><dd>First release.</dd></dl><h2 id="known-issues">Known Issues</h2><ul><li>No known issues.</li></ul><h2 id="license">License</h2><p>Copyright Jon Gibbins</p><p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at<br/></p><a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a><p><br/>Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.</p><p>This essentially means that you’re free to copy, modify and distribute it for any project so long as you provide clear attribution to the author. <a href="https://dotjay.com/contact">Get in touch</a> if you need a different license.</p><div id="footer" role="contentinfo"><p>#grid was built by <a href="https://dotjay.com/">Jon Gibbins</a> and designed by <a href="https://jontangerine.com/">Jon Tan</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></main><!-- Include the Hashgrid script--><script type="text/javascript" src="dist/javascripts/hashgrid.js"></script><!-- Kick Hashgrid into action--><script>var hg = new Hashgrid({
numberOfGrids: 2
});</script></body></html>