-
Notifications
You must be signed in to change notification settings - Fork 0
/
day3.html
458 lines (442 loc) · 20.9 KB
/
day3.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
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
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>INF 362 - Spring 2014 - Unit 3: Web DesignERS!</title>
<meta name="description" content="Web Design">
<meta name="author" content="Eric Steinborn">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="stylesheet" href="css/reveal.min.css">
<link rel="stylesheet" href="css/theme/default.css" id="theme">
<!-- For syntax highlighting -->
<link rel="stylesheet" href="lib/css/zenburn.css">
<!-- If the query includes 'print-pdf', use the PDF print sheet -->
<script>
document.write( '<link rel="stylesheet" href="css/print/' + ( window.location.search.match( /print-pdf/gi ) ? 'pdf' : 'paper' ) + '.css" type="text/css" media="print">' );
</script>
<!--[if lt IE 9]>
<script src="lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<!-- Unit 3 Day 3 Begin -->
<section>
<h3>Unit 3 - Day 3</h3>
<p>"Where things start to get, well, difficult..."</p>
</section>
<section>
<h2>Peer Evals</h2>
<p><a href="http://bit.ly/inf-af">http://bit.ly/inf-af</a></p>
<p><a href="http://bit.ly/inf-hb">http://bit.ly/inf-hb</a></p>
<p><a href="http://bit.ly/inf-t4">http://bit.ly/inf-t4</a></p>
<p><a href="http://bit.ly/inf-w3">http://bit.ly/inf-w3</a></p>
</section>
<section>
<h2>Anyone planning on attending or presenting at Open Source Festival?</h2>
<h3>3/20</h3>
<p>Proposals needed.</p>
</section>
<section>
<h2>CCI Day Signups 4/30</h2>
<p>Not just attending, but presenting</p>
</section>
<section>
<h2>UG Research Conference?</h2>
<h3>4/25 - 4/26</h3>
<p><a href="http://www.albany.edu/honorscollege/undergraduate_research_conference.php">More Info</a></p>
</section>
<section>
<h2>Moar?</h2>
</section>
<section data-background="img/moar_internets.jpg" data-background-size="50%" data-background-repeat="no-repeat">
</section>
<section data-background="img/moooaaarrr.jpg" data-background-size="40%" data-background-repeat="no-repeat">
</section>
<section data-background="img/found-moar.jpg" data-background-size="60%" data-background-repeat="no-repeat">
</section>
<section data-background="img/yup-needs-moar.jpg" data-background-size="60%" data-background-repeat="no-repeat">
</section>
<section data-background="img/more-in-3-2-1.jpg" data-background-size="60%" data-background-repeat="no-repeat">
</section>
<section data-background="img/moar.jpg" data-background-size="60%" data-background-repeat="no-repeat">
</section>
<section>
<h2>Do you have any questions?</h2>
</section>
<section>
<h2>GitHub Questions</h2>
</section>
<section>
<h2>Midterm project critique criteria</h2>
<p>What did you come up with?</p>
<p class="fragment">Rank Top 5</p>
<p class="fragment">Write Top 3</p>
<p class="fragment">If tied, write 4th then 5th</p>
</section>
<section>
<h2>My Midterm Grading Criteria</h2>
<h3>Individual Team Member Performance</h3>
<ul>
<li>Your commit history.</li>
<li>Completeness of your milestoned issues.</li>
<li>How often did you participate in group discussions?</li>
<li>Were you helpful if asked for help?</li>
<li>Did you ask for help if you needed it?</li>
</ul>
</section>
<section>
<h1>JavaScript!!!11!!one!</h1>
</section>
<section>
<pre><code class="javascript">var matches = function(el, selector) {
var _matches = (el.matches || el.matchesSelector ||
el.msMatchesSelector || el.mozMatchesSelector ||
el.webkitMatchesSelector || el.oMatchesSelector);
if (_matches) { return _matches.call(el, selector);
} else {
var nodes = el.parentNode.querySelectorAll(selector);
for (var i = nodes.length; i--;) {
if (nodes[i] === el)
return true;
} return false; }
};
matches(el, '.my-class');</code></pre>
</section>
<section>
<h2>With jQuery</h2>
<pre><code class="javascript">$(el).is('.my-class');</code></pre>
</section>
<section>
<h1>jQuery</h1>
<p>It makes JavaScript easier.</p>
</section>
<section>
<h2>jQuery</h2>
<pre><code class="javascript">$</code></pre>
</section>
<section data-background="img/Dolla-Dolla.png" data-background-size="45%" data-background-repeat="no-repeat">
</section>
<section>
<h2>Find a DOM element</h2>
<p>By CSS selector</p>
<pre><code class="javascript">$('.my-class');</code></pre>
</section>
<section>
<h2>Run a method on it</h2>
<pre><code class="javascript">$('.my-class').html();</code></pre>
</section>
<section>
<h2>Run an instructional method on it</h2>
<pre><code class="javascript">$('.my-class').fadeIn();</code></pre>
</section>
<section>
<h2>You can GET using methods</h2>
<pre><code class="javascript">var myHtml = $('.my-class').html();</code></pre>
</section>
<section>
<h2>You can SET using methods</h2>
<pre><code class="javascript">$('.my-class').html('<p>Hello World!</p>');</code></pre>
</section>
<section>
<h2>jQuery API</h2>
<p><a href="http://api.jquery.com">Use the Docs, Luke.</a></p>
</section>
<!-- Team demos -->
<section>
<h2>Make <div id="foo"> slide downward</h2>
<pre class="fragment"><code class="javascript">$('#foo').slideDown();</code></pre>
</section>
<section>
<h2>Fade <div class="foo"> out, fast</h2>
<pre class="fragment"><code class="javascript">$('.foo').fadeOut('fast');</code></pre>
</section>
<section>
<h2>Get the text value of <p class="foo"></h2>
<pre class="fragment"><code class="javascript">$('.foo').text();</code></pre>
</section>
<section>
<h2>Two types of functions</h2>
<p>Named</p>
<pre><code class="javascript">var eric = function() {};</code></pre>
<pre class="fragment"><code class="javascript">eric();</code></pre>
</section>
<section>
<h2>Two types of functions</h2>
<p>Anonymous</p>
<pre><code class="javascript">function() {};</code></pre>
<p class="fragment">Run within another function to execute immediately.</p>
</section>
<section>
<h2>Run a function when you click <a class="foo"></h2>
<p>Anonymous or named</p>
<pre class="fragment"><code class="javascript">$('.foo').click(function(){});</code></pre>
<pre class="fragment"><code class="javascript">$('.foo').click(eric);</code></pre>
</section>
<!-- End Team Demos -->
<section>
<h2>You can SET using functions, too</h2>
<pre><code class="javascript">$('.my-class').html(function(){
var myHtml = '<p>Hello World!</p>';
return myHtml;
);</code></pre>
</section>
<section>
<h2>Run a function after the method completes</h2>
<p>"callback"</p>
<pre><code class="javascript">$('.my-class').fadeIn("slow", function(){/*complete*/});</code></pre>
</section>
<section>
<h2>Click Events</h2>
<pre><code class="javascript">$('.my-class').click(function(){});</code></pre>
</section>
<section>
<h2>Better Click Events</h2>
<p>Event Delegation</p>
<pre><code class="javascript">$('.foo').on('click', '.my-class', function(){});</code></pre>
<!-- Team Demos -->
<div class="fragment" data-fragment-index="1">
<h3>.foo?</h3>
<ol>
<li>Direct Parent Element</li>
<li>Any parent element <span class="fragment correct correct-no-code" data-fragment-index="2">★</span></li>
<li>Sibling Element</li>
<li>Child Element</li>
</ol>
</div>
</section>
<section>
<h2>You can only map to click events in jQuery</h2>
<ol>
<li>True</li>
<li>False <span class="fragment correct correct-no-code" data-fragment-index="2">★</span></li>
</ol>
</section>
<section>
<h2>Why is it better to use .on()?</h2>
<ol>
<li>Sometimes we don't only want a click to trigger our event. <span class="fragment correct correct-no-code" data-fragment-index="2">★</span></li>
<li>You can only send data to .on() events.</li>
<li>Touch-based mobile devices don't have a "click" method.</li>
<li>Handles elements not available on document.load. <span class="fragment correct correct-no-code" data-fragment-index="2">★</span></li>
<li>You can only assign events to multiple targets with .on().</li>
</ol>
</section>
<section>
<h2>Even Better Click Events</h2>
<pre><code class="javascript">$('.foo').on('click', '.my-class', function(e){
e.preventDefault();
});</code></pre>
<div class="fragment" data-fragment-index="1">
<h3>e?</h3>
<ol>
<li>e = A variable for all events</li>
<li>e = The variable assigned to the default event object <span class="fragment correct correct-no-code" data-fragment-index="2">★</span></li>
<li>e = Everything.. (all javascript on page)</li>
<li>e = .foo's DOM element</li>
</ol>
<p class="fragment" data-fragment-index="3">Prevent Default Event</p>
</div>
</section>
<section>
<h2>Run text() and fadeIn() on .foo</h2>
<pre class="fragment"><code class="javascript">$('.foo').text();
$('.foo').fadeIn();</code></pre>
</section>
<!-- End Team Demos -->
<section>
<h2>That's all well and good, but what about:</h2>
<pre class="fragment"><code class="javascript">$('.foo').slideToggle('fast');
$('.foo').text();
$('.foo').html();
$('.foo').slideToggle('slow');
$('.foo').fadeIn();
$('.foo').click(function(e){e.preventDefault();});</code></pre>
</section>
<section>
<h3>Ch-Ch-Ch-Ch-Chaining!</h3>
<pre><code class="javascript">$('.my-class')
.slideToggle('fast')
.text('moar!')
.html(function(index, oldHtml){
return oldHtml + ' Internetz!!';
})
.slideToggle('slow')
.fadeIn(3000)
.click(function(e){
e.preventDefault();
console.log('done!')});</code></pre>
</section>
<section>
<h1><a class="my-class">Click Me</a></h1>
</section>
<section>
<h2>jQuery has lots of Built-in Methods</h2>
<p>Lots and lots and lots and lots!</p>
</section>
<section>
<h2>Add class "moar" to .foo</h2>
<pre class="fragment" data-fragment-index="1"><code class="javascript">$('.foo').addClass('moar');</code></pre>
<h2 class="fragment" data-fragment-index="2">Remove class "moar" from .foo</h2>
<pre class="fragment" data-fragment-index="3"><code class="javascript">$('.foo').removeClass('moar');</code></pre>
</section>
<section>
<h2>If .foo hasClass more, remove it.<br>
If it doesn't, add it.</h2>
<pre class="fragment"><code class="javascript">$('.foo').toggleClass('moar');</code></pre>
</section>
<section>
<h2>Change the text of .foo to "Hello, World!"</h2>
<pre class="fragment"><code class="javascript">$('.foo').text('Hello, World!');</code></pre>
</section>
<section>
<h2>Assign the text of .foo to .bar</h2>
<pre class="fragment"><code class="javascript">$('.bar').text($('.foo').text());</code></pre>
<pre class="fragment"><code class="javascript">var fooText = $('.foo').text();
$('.bar').text(fooText);</code></pre>
<p class="fragment">Works exactly the same for HTML (except for HTML tags).</p>
</section>
<section>
<h2>Get the value of .foo</h2>
<pre class="fragment"><code class="javascript">var fooVal = $('.foo').val();</code></pre>
<p class="fragment">val() attr()</p>
<p class="fragment">To retrieve and change DOM properties such as the checked, selected, or disabled state of form elements, use the .prop() method. For everythign else, use attr()</p>
</section>
<section>
<h2>Get the value of .foo append it to .bar</h2>
<pre class="fragment"><code class="javascript">var fooVal = $('.foo').val();
$('.bar').append(fooVal);</code></pre>
<pre class="fragment"><code class="html">before()
wrap(begin)
<span class="bar">prepend() <-- Content --> append()</span>
wrap(end)
after()</code></pre>
<p class="fragment">appendTo(), prependTo(), insertAfter(), insertBefore()</p>
</section>
<section>
<h2>Setting, & setting multiple</h2>
<pre><code class="javascript">$( "#greatphoto" ).attr( "title", "Photo by Kelly Clark" );</code></pre>
<pre><code class="javascript">$( "#greatphoto" ).attr({
alt: "Beijing Brush Seller",
title: "photo by Kelly Clark"
});</code></pre>
<p>You can do this with the .css property too... but don't use add/remove/toggle class.</p>
</section>
<section>
<h2>Fade .foo out over 2 seconds</h2>
<pre class="fragment"><code class="javascript">$('.foo').fadeOut(2000);</code></pre>
<p class="fragment">fadeIn(), slideUp(), slideDown(), slideToggle()</p>
</section>
<section>
<h2>Hide .foo</h2>
<pre class="fragment"><code class="javascript">$('.foo').hide();</code></pre>
<pre class="fragment"><code class="javascript">$('.foo').addClass('hidden');</code></pre>
<p class="fragment">Cut as much DOM manipulation as you can.</p>
</section>
<section>
<h2>Given .foo find a .bar within it</h2>
<pre class="fragment"><code class="javascript">$('.foo').find('.bar');</code></pre>
<p class="fragment">More performant than $('.foo .bar');</p>
</section>
<section>
<h2>Ajax pull from http://google.com into .foo</h2>
<pre class="fragment"><code class="javascript">$('.foo').load('http://google.com');</code></pre>
<p class="fragment">load() is a super quick AJAX request. Deeper AJAX will come later on</p>
</section>
<section>
<h2>Mobile Device Remote Inspection Demo</h2>
<p><a href="http://timgthomas.com/2012/09/inspect-mobile-web-sites-with-a-mac-and-ios-6/">iOS config</a></p>
<p><a href="https://developers.google.com/chrome-developer-tools/docs/remote-debugging">Android Config</a></p>
</section>
<section>
<h1>Next Time on...</h1>
<h1 class="blood">INF 362!</h1>
</section>
<section>
<ol>
<li>CSS3</li>
<li>Browser Compatbility</li>
<li>Progressive Enhancement</li>
</ol>
</section>
<section>
<h2>Mid Term Draft Due 3/24</h2>
<p>No class next week.</p>
<p>Midterm due 3/31, not 4/7</p>
</section>
<section>
<h2>My Midterm Requirements</h2>
<ul>
<li>Based off Zurb Foundation 5</li>
<li>Responsive Layout to "large", optimized for mobile</li>
<li>Responsive Nav scales to "large"</li>
<li>Responsive Images (interchange)</li>
<li>Flow of app fully realized</li>
<li>Content complete</li>
<li>Uses SASS
<ul>
<li>Nesting, Variables, Scaffolding</li>
<li>Modifies at least 5 F5 variables</li>
<li>Makes use of at least 2 custom media query breakpoints</li>
</ul>
</li>
<li>Uses jQuery (custom, not just F5)</li>
<li>Color scheme implemented</li>
<li>Follows Google's HTML/CSS/JS styleguide</li>
</ul>
</section>
<section>
<h1>TODO: Next Class</h1>
<h2>Add Foundation 5 to your projects if you havent already</h2>
<p><a href="https://github.com/esteinborn/foundation-boilerplate">Foundation 5 Boilerplate</a> (DON'T FORK, download)</p>
<ul>
<li><a href="http://foundation.zurb.com/docs/">Start implementing lots of foundation bits and pieces</a></li>
<li>Start thinking about and implementing larger screen sizes (medium/large)</li>
<li><a href="https://github.com/zurb/foundation-5-sublime-snippets">Easy to use Sublime Text Foundation 5 snippets</a></li>
<li><a href="http://www.sitepoint.com/architecture-sass-project/">a sample Sass architecture</a></li>
</ul>
</section>
</div>
</div>
<script src="lib/js/head.min.js"></script>
<script src="js/reveal.min.js"></script>
<script src="lib/js/jquery.js"></script>
<script>
// Full list of configuration options available here:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
controls: true,
progress: true,
history: true,
center: true,
slideNumber: true,
height: "100%",
width: "95%",
theme: Reveal.getQueryHash().theme, // available themes are in /css/theme
transition: Reveal.getQueryHash().transition || 'default', // default/cube/page/concave/zoom/linear/fade/none
// Optional libraries used to extend on reveal.js
dependencies: [
{ src: 'lib/js/classList.js', condition: function() { return !document.body.classList; } },
{ src: 'plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } },
{ src: 'plugin/notes/notes.js', async: true, condition: function() { return !!document.body.classList; } },
{ src: 'plugin/search/search.js', async: true, condition: function() { return !!document.body.classList; } }
]
});
$('.my-class').click(function(){
$(this)
.slideToggle(400, function(){
$(this)
.text('moar!')
.html(function(index, oldHtml){
return oldHtml + ' Internetz!!';})
.css({"font-size": "1.25em"});
})
.slideToggle(3000);
});
</script>
</body>
</html>