-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
410 lines (393 loc) · 21.7 KB
/
index.php
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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
<? require_once('header.php'); ?>
<aside id="sidebar">
<nav>
<a href="#basic">Basic</a>
<a href="#nested">Nested</a>
<a href="#cycle">Cycle</a>
<a href="#spanning">Spanning</a>
<a href="#offsets">Offsets</a>
<a href="#ordering">Ordering</a>
<a href="#centering">Centering</a>
<a href="#editing">Editing</a>
<a href="#mobile">Mobile</a>
<a href="#stack">Stack</a>
</nav>
</aside>
<section class="basics">
<article>
<div class="code" id="frontpage_head">
<h1>Hi there! I'm Jeet</h1>
<p>
I make short work of creating responsive, semantic, flexible, fun, websites.
</p>
<p>
Grab some popcorn and check out the video to get a feel for how I work.
</p>
</div>
<div class="result">
<div class="vid_wrap">
<iframe width="640" height="480" src="//www.youtube.com/embed/dcCTDAL7mi0?rel=0&vq=hd1080" frameborder="0" allowfullscreen></iframe>
</div>
</div>
</article>
<article class="basic" id="basic">
<div class="code">
<pre class="html">
<aside>Sidebar</aside>
<article>Article</article></pre>
<pre class="styl">
aside
col(1/3)
article
col(2/3)</pre>
</div>
<div class="result">
<header>
<h4>Basic</h4>
<p>
It's that easy. But look carefully at the gutter between these two elements and, say, the gutters between the navigation buttons at the top of the page. <a href="http://youtu.be/ueZ6tvqhk8U?t=16s" target="_blank">One of these things is not like the other</a>! It's because we're using percentage-based gutters. So 2% of a 1000px container is going to be bigger than 2% of a 100px container. It works, but it effectively defeats the whole purpose of using grids since they're meant to be uniform.
</p>
<p>
How can we fix this?
</p>
</header>
<div class="demo">
<aside>Sidebar</aside>
<article>Article</article>
</div>
<p data-height="268" data-theme-id="0" data-slug-hash="DnFbr" data-user="corysimmons" data-default-tab="result" class='codepen'>See the Pen <a href='http://codepen.io/corysimmons/pen/DnFbr'>Jeet 3 - Playground</a> by Cory Simmons (<a href='http://codepen.io/corysimmons'>@corysimmons</a>) on <a href='http://codepen.io'>CodePen</a></p>
<script async src="http://codepen.io/assets/embed/ei.js"></script>
</div>
</article>
<article class="nested" id="nested">
<div class="code">
<pre class="html">
<aside>Sidebar</aside>
<article>Article</article></pre>
<pre class="styl">
aside
col(1/3 1.5/2.5 7/8)
article
col(2/3 1.5/2.5 7/8)</pre>
</div>
<div class="result">
<header>
<h4>Nested</h4>
<p>
If we pass the ratios of parent containers like so: <code><div class="result"></code> is the container of these <code><aside></code> and <code><article></code> elements and it's set to <code>col(1.5/2.5 7/8)</code>. The parent of <code><div class="result"></code> is <code><section class="basics"></code> and it's set to <code>col(7/8)</code>. So if we're setting the <code><aside></code>'s column size to <b>1/3</b> we need to say <i>"1/3 of 1.5/2.5 of 7/8"</i> like so: <code>col(1/3 1.5/2.5 7/8)</code>.
</p>
<p>
You need to do this with every parent that is using <code>col()</code> so if you're doing some crazy-deep nesting, you may end up with something that looks like this: <code>col(1/2 1/3 1/2 1/4 1/7 2.5/8)</code>. Typically you won't run into this, but if you do, don't be scared. Just step through your code and you'll get the hang of it. Then you'll be the coolest kid on the block with your nice, percentage-based, consistent, gutters.
</p>
<p>
The only other grid that attempts to do this correctly is Scott Kellum's <a href="http://singularity.gs" target="_blank">Singularity.gs</a>. Singularity's syntax isn't my cup of tea, but it really is a brilliant system and the only other system that provides incredibly flexible ratio/percentage-based columns while maintaining a consistent gutter.
</p>
<p>
Props aside, we've worked hard to make Jeet 3's syntax very intuitive but if you still find it too hard to manage, just start off using the basic syntax like above. You'll get great columns/gutters in a more flexible/semantic/intuitive syntax than other frameworks, and when you're ready you can start using nested ratios.
</p>
</header>
<div class="demo">
<aside>Sidebar</aside>
<article>Article</article>
</div>
<p data-height="266" data-theme-id="1612" data-slug-hash="bpHIv" data-user="corysimmons" data-default-tab="result" class='codepen'>See the Pen <a href='http://codepen.io/corysimmons/pen/bpHIv'>Jeet 3 - Nested</a> by Cory Simmons (<a href='http://codepen.io/corysimmons'>@corysimmons</a>) on <a href='http://codepen.io'>CodePen</a></p>
<script async src="http://codepen.io/assets/embed/ei.js"></script>
</div>
</article>
<article class="cycle" id="cycle">
<div class="code">
<pre class="html">
<div class="block">Block 1</div>
<div class="block">Block 2</div>
<div class="block">Block 3</div>
<div class="block">Block 4</div>
<div class="block">Block 5</div>
<div class="block">Block 6</div>
<div class="block">Block 7</div></pre>
<pre class="styl">
.block
col(1/4 1.5/2.5 7/8, cycle: 4)
</pre>
</div>
<div class="result">
<header>
<h4>Cycle and Uncycle</h4>
<p>
So it'd be cool if we had a big image gallery, or some products in a store, or pretty much anything that has equal height, if we could just dump items into a container and they automatically wrap down to the next row. We do this with the <code>cycle</code> argument.
</p>
<p>
Pass your ratios as you normally would, then pass how many elements until they drop down to the next row.
</p>
<p>
Now you might want to cycle differently at various breakpoints, in which case you <b>need</b> to <code>uncycle</code> what you previously cycled, and set a new cycle argument like so: <code>col(1/2 1.5/2.5 7/8, uncycle: 4, cycle: 2)</code> which would turn off cycling on every 4th element and start cycling every 2nd element. Make sure to adjust your initial ratio. For instance, I changed this to <b>1/2</b> so only 2 blocks would appear per row at smaller sizes.
</p>
<p>
<b>Bonus!</b> <code>cycle</code> will fix Safari/Opera's insanely horrible subpixel rounding crap which is an error present in every percentage based grid. So it's good to familiarize yourself with it - even if you don't have a need for blocks at the time.
</p>
</header>
<div class="demo">
<div class="block">Block 1</div>
<div class="block">Block 2</div>
<div class="block">Block 3</div>
<div class="block">Block 4</div>
<div class="block">Block 5</div>
<div class="block">Block 6</div>
<div class="block">Block 7</div>
</div>
<p data-height="266" data-theme-id="1612" data-slug-hash="hsfue" data-user="corysimmons" data-default-tab="result" class='codepen'>See the Pen <a href='http://codepen.io/corysimmons/pen/hsfue'>Jeet 3 - Cycle / Uncycle</a> by Cory Simmons (<a href='http://codepen.io/corysimmons'>@corysimmons</a>) on <a href='http://codepen.io'>CodePen</a></p>
<script async src="http://codepen.io/assets/embed/ei.js"></script>
</div>
</article>
<article class="spans" id="spanning">
<div class="code">
<pre class="html">
<nav>
<a href="#">Link</a>
<a href="#">Link</a>
<a href="#">Link</a>
</nav></pre>
<pre class="styl">
nav a
span(1/3)</pre>
</div>
<div class="result">
<header>
<h4>Spans</h4>
<p>
A lot of frameworks make you choose between columns or spans by setting a global gutter variable. Jeet understands there are different parts to every website that require a different tool. So, you want a horizontal navigation list with no gutters between each item?
</p>
<p>
<b>Bonus!</b> You don't have to pass multiple ratios to <code>span()</code> because it doesn't need to calculate gutters. Just pass one ratio and enjoy.
</p>
</header>
<div class="demo">
<nav>
<a href="#">Link</a>
<a href="#">Link</a>
<a href="#">Link</a>
</nav>
</div>
</div>
</article>
<article class="offsets" id="offsets">
<div class="code">
<pre class="html">
<a href="#" class="logo">Logo</a>
<nav>
<a href="#">Link</a>
<a href="#">Link</a>
<a href="#">Link</a>
</nav></pre>
<pre class="styl">
.logo
col(1/4 1.5/2.5 7/8)
nav
col(1/2 1.5/2.5 7/8, offset: 1/4)</pre>
</div>
<div class="result">
<header>
<h4>Offsets</h4>
<p>
Want to put a bit more space between items? Leave bit off of your <code>col()</code> (or <code>span()</code>) elements, then pass the <code>offset</code> as a param to one of your elements.
</p>
<p>
You can also use a negative value for your offset to have it offset in the opposite direction.
</p>
<p>
<b>Bonus!</b> Again, don't worry about copying the parent ratios over to the <code>offset</code> param. It pulls the data from the first param in <code>col()</code>
</p>
</header>
<div class="demo">
<a href="#" class="logo">Logo</a>
<nav>
<a href="#">Link</a>
<a href="#">Link</a>
<a href="#">Link</a>
</nav>
</div>
</div>
</article>
<article class="ordering" id="ordering">
<div class="code">
<pre class="html">
<article>Article</article>
<nav>
<a href="#">Link</a>
<a href="#">Link</a>
<a href="#">Link</a>
</nav></pre>
<pre class="styl">
article
col(3/5 1.5/2.5 7/8)
nav
col(2/5 1.5/2.5 7/8)
// Mobile
bp()
article
shift(2/5 1.5/2.5 7/8)
nav
shift(-3/5 1.5/2.5 7/8)
endbp()
</pre>
</div>
<div class="result">
<header>
<h4>Source Ordering</h4>
<p>
We use a mixin called <code>shift()</code> to re-position content. Look at the below example and then resize your browser to see <code><article></code> and <code><nav></code> switch places.
</p>
<p>
Use a negative shift to move items to the left, and a positive shift to move them to the right.
</p>
<p>
If you end up deciding you don't want things to be shifted, you can use the <code>unshift()</code> mixin which accepts no params to... well... "unshift" elements.
</p>
</header>
<div class="demo">
<article>Article</article>
<nav>
<a href="#">Link</a>
<a href="#">Link</a>
<a href="#">Link</a>
</nav>
</div>
</div>
</article>
<article class="centering" id="centering">
<div class="code">
<pre class="html">
<header>
<div>
Full-width Background / Centered Content
</div>
</header></pre>
<pre class="styl">
header
background rgba(#000, .15)
> div
center(250px)
</pre>
</div>
<div class="result">
<header>
<h4>Centering</h4>
<p>
Jeet comes with the <code>center()</code> mixin which accepts a max-width as it's first argument, and left/right padding as it's second. You can use it on anything, but it works best on wrapper elements. It's simple, effective, and useful.
</p>
<p>
One of my favorite uses for <code>center()</code> is to set a full-width background, then make the immediate child <code><div></code> of that element <code>center()</code>'d to center content.
</p>
</header>
<div class="demo">
<header>
<div>
Full-width Background / Centered Content
</div>
</header>
</div>
</div>
</article>
<article class="edit" id="editing">
<div class="code">
<pre class="html">
<section>
<article>
<header>Header</header>
<p>
Lorem ipsum dolor...
</p>
</article>
<aside>Sidebar</aside>
</section></pre>
<pre class="styl">
edit()</pre>
</div>
<div class="result">
<header>
<h4>Visual Editing</h4>
<p>
We've added a super-handy <code>edit()</code> mixin that accepts no params. It basically just gives everything a very light, translucent, gray color. You can see it in practice in all of these demos. It also sets an easing <code>transistion</code> that will animate your changes (pretty cool). These simple properties let you visualize all your elements containers and such without having to constantly be opening/closing Inspector.
</p>
<p>
<b>Note:</b> The rounded corners/padding that appear in most of this doc isn't part of <code>edit()</code> but can easily be added if that's your thing.
</p>
</header>
<div class="demo">
<section>
<article>
<header>Header</header>
<p>
Lorem ipsum dolor...
</p>
</article>
<aside>Sidebar</aside>
</section>
</div>
</div>
</article>
<article class="mobile" id="mobile">
<div class="code">
<pre class="html">
<div>
They call 'em fingers but you never see them fing.
Oh! There they go!
</div></pre>
<pre class="styl">
div
flash(warning)
bp(550px, mf)
div
flash(error)
endbp()</pre>
</div>
<div class="result">
<header>
<h4>Breakpoints and Mobile-first</h4>
<p>
Jeet makes setting breakpoints easy. There's no device specific sizing stuff like "hide on tablet" and all that junk because that stuff makes <a href="http://bradfrostweb.com/blog/post/7-habits-of-highly-effective-media-queries/#content" target="_blank">kittens get their heads bitten off by angels</a>. Instead, it just lets you specify a width by whatever value you want (<code>px</code>, <code>em</code>, <code>percentages</code>, etc. are all accepted).
</p>
<p>
After that, you can define if you want to make your design mobile-first. By default, it's not mobile-first because I'm lazy and used to desktop-first, but to turn your breakpoints into mobile-first, just pass <code>mf</code> as the second param, or do <code>bp(mobile_first: mf)</code>.
</p>
</header>
<div class="demo">
<div>
They call 'em fingers but you never see them fing. Oh! There they go!
</div>
</div>
</div>
</article>
<article class="stack" id="stack">
<div class="code">
<pre class="html">
<aside>Sidebar</aside>
<article>Article</article></pre>
<pre class="styl">
aside
col(1/3 1.5/2.5 7/8)
article
col(2/3 1.5/2.5 7/8)
bp(1000px)
aside, article
stack(align: left)
endbp()
</pre>
</div>
<div class="result">
<header>
<h4>Stacking Blocks</h4>
<p>
Another convenient mixin Jeet provides is <code>stack()</code> which accepts left and right padding in case you want something to be smaller and more centered, or you want to pass <b>0</b> and just have your content bump up against the edges of the page (assuming a <code>center()</code> wrapper element isn't applying padding already).
</p>
<p>
Scale your browser down and at 1000px width the <code><aside></code> and <code><article></code> will stack on top of each other.
</p>
</header>
<div class="demo">
<aside>Sidebar</aside>
<article>Article</article>
</div>
</div>
</article>
</section>
<? require_once('footer.php'); ?>