Skip to content
Navigation Menu
{{ message }}
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
402 lines (337 loc) · 10.5 KB
/
Copy pathindex.html
File metadata and controls
402 lines (337 loc) · 10.5 KB
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
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Javascript & jQuery</title>
<meta name="description" content="Javascript & jQuery">
<meta name="author" content="Kevin Gorski">
<meta name="viewport" content="width=1024, user-scalable=no">
<link rel="stylesheet" href="core/deck.core.css">
<link rel="stylesheet" href="extensions/goto/deck.goto.css">
<link rel="stylesheet" href="extensions/menu/deck.menu.css">
<link rel="stylesheet" href="extensions/navigation/deck.navigation.css">
<link rel="stylesheet" href="extensions/status/deck.status.css">
<link rel="stylesheet" href="extensions/hash/deck.hash.css">
<link rel="stylesheet" href="extensions/codemirror/deck.codemirror.css">
<link rel="stylesheet" href="extensions/codemirror/themes/default.css">
<link rel="stylesheet" id="style-theme-link" href="themes/style/swiss.css">
<link rel="stylesheet" id="transition-theme-link" href="themes/transition/horizontal-slide.css">
<link rel="stylesheet" id="custom-theme-link" href="custom.css">
<script src="modernizr.custom.js"></script>
</head>
<body class="deck-container">
<section class="slide" id="title-slide">
<h1>JavaScript & jQuery</h1>
<h2>Made with Deck.js</h2>
<h3>http://imakewebthings.github.com/deck.js/</h3>
</section>
<section class="slide">
<h2>Why JavaScript?</h2>
<h3>JavaScript is becoming ubiquitous</h3>
<ul>
<li class="slide">
<h3>Behavior in documents</h3>
<ul>
<li>HTML</li>
<li>PDF</li>
</ul>
</li>
<li class="slide">
<h3>Document databases speak & write it</h3>
<ul>
<li>JSON</li>
<li>Mongo</li>
<li>CouchDB</li>
</ul>
</li>
<li class="slide"><h3>Node.js</h3></li>
</ul>
</section>
<section class="slide">
<h2>Behavior in the Browser</h2>
<h3>Document Object Model</h3>
<ul>
<li class="slide">Event Handling</li>
<li class="slide">Document Updates
<ul>
<li>Animation</li>
<li><a href="http://letteringjs.com/">Lettering.js</a></li>
<li><a href="http://leaverou.github.com/prefixfree/">-prefix-free</a></li>
</ul>
</li>
<li class="slide">Networking (AJAX, AJAH, AJAJ)</li>
</ul>
</section>
<section class="slide">
<h2>Browser Differences</h2>
<ul>
<li>Syntax</li>
<li>Performance</li>
<li>Implementation</li>
<li>Feature Set</li>
</ul>
</section>
<section class="slide">
<h2>JavaScript Libraries</h2>
<ul>
<li>There are many</li>
<li>jQuery stands out
<ul>
<li>Widely used - 50% of top 10k sites (builtwith.com)</li>
<li>Microsoft endorsed (included with Visual Studio)</li>
<li>Well tested for cross-compatibility & performance</li>
<li>Large library of plug-ins</li>
</ul>
</li>
</ul>
</section>
<section class="slide">
<h2>Getting Started</h2>
<textarea class="code" mode="javascript" style="display: none;" runnable="true">
// Types, but not typed variables
var subject = "world";
var sayHello = function (message) {
console.log("Hello " + message + "!");
}
sayHello(subject);
// Type inference
sayHello('#' + (5 + 1));
</textarea>
</section>
<section class="slide">
<h2>Familiar Ground</h2>
<ul>
<li>if</li>
<li>while</li>
<li>for</li>
<li>switch</li>
<li>try/catch/throw</li>
<li>== vs. ===</li>
</ul>
</section>
<section class="slide">
<h2>Built-in Types</h2>
<ul>
<li>Primitive types - number, string, boolean, null, undefined</li>
<li>Arrays - operate like arrays, lists, queues, stack</li>
<li>Date</li>
<li>RegExp
<textarea class="code" mode="javascript" style="display: none;" runnable="true">
console.log(/(no )?way/.test('way') ? 'righteous' : 'bummer');
</textarea>
</li>
<li>Function</li>
</ul>
</section>
<section class="slide">
<h2>I, Object!</h2>
<textarea class="code" mode="javascript" style="display: none;" runnable="true">
var verbose = new Object();
var terse = {};
// More realistic
var joey = {
name: "Joey",
sayHello: function() {
// What's this?
console.log("My name is " + this.name);
}
};
joey.sayHello();
joey["sayHello"]();
var whoSays = joey.sayHello;
// Here, called without objective context
whoSays();
whoSays.call(joey);
</textarea>
</section>
<section class="slide">
<h2>Constructors</h2>
<ul>
<li>A function called with the "new" keyword that returns an object</li>
<li>Capitalized by convention</li>
</ul>
<textarea class="code" mode="javascript" style="display: none;" runnable="true">
function Person(name) {
this.name = name;
this.sayHello = function() {
console.log("My name is " + this.name);
}
// return of this implied
}
var joey = new Person("Joey");
joey.sayHello();
</textarea>
</section>
<section class="slide">
<h2>Classes</h2>
<ul>
<li class="slide">We don't need no stinking classes</li>
<li class="slide">You can build a "classical" inheritance model if you really want</li>
<li class="slide">But you really don't</li>
</ul>
</section>
<section class="slide">
<h2>Prototypical Inheritance</h2>
<ul>
<li>Every object has a special "prototype" property</li>
<li>Accessing a method or property of an object checks the object first, then the prototype</li>
<li>Because the prototype itself is an object, the chain can be extended</li>
<li>All objects created with the same constructor share a prototype</li>
</ul>
<textarea class="code" mode="javascript" style="display: none;" runnable="true">
function Person(name) {
this.name = name;
}
var joey = new Person("Joey");
Person.prototype.sayHello = function() {
console.log("My name is " + this.name);
}
var bobby = new Person("Bobby Tables");
joey.sayHello();
bobby.sayHello();</textarea>
</section>
<section class="slide">
<h2>More Prototypes</h2>
<textarea class="code" mode="javascript" style="display: none;" runnable="true">
function Person(name) {
this.name = name;
}
Person.prototype.sayHello = function() {
console.log("My name is " + this.name);
}
function Employee(name, position) {
this.position = position;
this.name = name;
}
Employee.prototype = new Person();
Employee.prototype.constuctor = Employee;
Employee.prototype.whatDoYouDo = function() {
console.log("I'm a " + this.position);
}
var homer = new Employee("Homer", "Nuclear Power Engineer");
homer.sayHello();
homer.whatDoYouDo();</textarea>
</section>
<section class="slide">
<h2>The jQuery Function</h2>
<ul>
<li>jQuery() or $()</li>
<li>Behaves differently based on type of input
<ul>
<li>DOM Elements => Wrap in jQuery set</li>
<li>String => Select elements OR create elements from HTML</li>
<li>Function => Register for document.ready</li>
</ul>
</li>
<li>Return value is usually another jQuery set, which enables "method chaining"</li>
</ul>
</section>
<section class="slide" id="jQuerySelectors">
<h2>Selectors</h2>
<ul>
<li>A combination of CSS 3 & XPath for locating DOM elements</li>
</ul>
<textarea class="code" mode="javascript" style="display: none;" runnable="true" globals="$">
console.log('List items: ' + $('#jQuerySelectors li').length);
console.log('Headers & list items: '
+ $('#jQuerySelectors h2, #jQuerySelectors li').length);
console.log('Headers & list items, context: '
+ $('h2, li', '#jQuerySelectors').length);
$('section[id$=Selectors]')
.css('border', 'thin red solid');
$('section[id$=Selectors]').css({
'background': '#CCC',
'color': '#C00'
});</textarea>
</section>
<section class="slide">
<h2>Event Handling</h2>
<button id="ClickDemo">Click Me!</button>
<textarea class="code" mode="javascript" style="display: none;" runnable="true" globals="$">
$('#ClickDemo').click(function() {
alert("clicked!");
});
// Similar API for select lists, hovering elements, key presses
// Live / Delegated events
$('.DynamicClickMe').live('click', function() {
// Any current or future elements that match will have this handler attached
});
</textarea>
</section>
<section class="slide">
<h2>DOM Manipulation</h2>
<ul id="DomManipulation">
</ul>
<textarea class="code" mode="javascript" style="display: none;" runnable="true" globals="$">
$('#DomManipulation').append('<li>item</li>');
// Other positions
// Add/remove/toggle CSS classes
// Add/remove attributes
// Get/set innerHTML, height/width</textarea>
</section>
<section class="slide">
<h2>Animation</h2>
<ul id="Animation">
</ul>
<textarea class="code" mode="javascript" style="display: none;" runnable="true" globals="$">
$('<li>item</li>')
.hide()
.appendTo('#Animation')
.fadeIn('slow');</textarea>
</section>
<section class="slide">
<h2>Building on jQuery</h2>
<ul>
<li>Plug-ins</li>
<li>jQuery UI</li>
<li>jQuery Mobile</li>
</ul>
</section>
<a href="#" class="deck-prev-link" title="Previous">←</a>
<a href="#" class="deck-next-link" title="Next">→</a>
<p class="deck-status">
<span class="deck-status-current"></span>
/
<span class="deck-status-total"></span>
</p>
<form action="." method="get" class="goto-form">
<label for="goto-slide">Go to slide:</label>
<input type="number" name="slidenum" id="goto-slide">
<input type="submit" value="Go">
</form>
<a href="." title="Permalink to this slide" class="deck-permalink">#</a>
<script src="jquery-1.6.4.min.js"></script>
<!-- Deck Core and extensions -->
<script src="core/deck.core.js"></script>
<script src="extensions/menu/deck.menu.js"></script>
<script src="extensions/goto/deck.goto.js"></script>
<script src="extensions/status/deck.status.js"></script>
<script src="extensions/navigation/deck.navigation.js"></script>
<script src="extensions/hash/deck.hash.js"></script>
<!-- Base codemiror code -->
<script src="extensions/codemirror/codemirror.js"></script>
<!-- Syntax highlighting Modes -->
<!-- javascript -->
<script src="extensions/codemirror/mode/javascript/javascript.js"></script>
<!-- html mode (note html mode requires xml, css and javascript) -->
<script src="extensions/codemirror/mode/xml/xml.js"></script>
<script src="extensions/codemirror/mode/css/css.js"></script>
<script src="extensions/codemirror/mode/htmlmixed/htmlmixed.js"></script>
<!-- Plugin code -->
<script src="extensions/codemirror/deck.codemirror.js"></script>
<!-- Specific to this page -->
<script>
$(function() {
// Deck initialization
$.deck('.slide');
$('#ClickDemo').click(function() {
alert("clicked!");
});
});
</script>
</body>
</html>
You can’t perform that action at this time.
