Learning jQuery, Third Edition

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

Step through each of the core concepts of the jQuery library, building an overall picture of its capabilities. Once you have thoroughly covered the basics, the book returns to each concept to cover more advanced examples and techniques. This book is for web designers who want to create interactive elements for their designs, and for developers who want to create the best user interface for their web applications. Basic JavaScript programming and knowledge of HTML and CSS is required. No knowledge of jQuery is assumed, nor is experience with any other JavaScript libraries.

Author(s): Jonathan Chaffer, Karl Swedberg
Edition: 3
Publisher: Packt Publishing
Year: 2011

Language: English
Pages: 428
Tags: Библиотека;Компьютерная литература;HTML / CSS / JavaScript;jQuery;

Cover......Page 1
Copyright......Page 3
Credits......Page 4
Foreword......Page 6
About the Authors......Page 8
About the Reviewers......Page 10
www.PacktPub.com......Page 11
Table of Contents......Page 12
Preface......Page 22
What jQuery does......Page 30
Why jQuery works well......Page 32
Downloading jQuery......Page 33
Setting up jQuery in an HTML document......Page 34
Adding our jQuery code......Page 37
Executing the code......Page 38
Plain JavaScript vs. jQuery......Page 40
Development tools......Page 41
Firebug......Page 42
Summary......Page 45
The Document Object Model......Page 46
The $() function......Page 48
CSS selectors......Page 49
Styling list-item levels......Page 50
Styling links......Page 52
Styling alternate rows......Page 55
DOM traversal methods......Page 60
Styling specific cells......Page 62
Chaining......Page 64
Accessing DOM elements......Page 65
Exercises......Page 66
Timing of code execution......Page 68
Multiple scripts on one page......Page 69
Passing an argument to the .ready() callback......Page 71
A simple style switcher......Page 72
Enabling the other buttons......Page 75
Event handler context......Page 76
Further consolidation......Page 78
Shorthand events......Page 80
Showing and hiding advanced features......Page 82
Highlighting clickable items......Page 84
The journey of an event......Page 86
Side effects of event bubbling......Page 87
Altering the journey: the event object......Page 88
Event targets......Page 89
Stopping event propagation......Page 90
Event delegation......Page 91
Methods for event delegation......Page 94
Removing an event handler......Page 95
Rebinding events......Page 96
Simulating user interaction......Page 99
Keyboard events......Page 100
Summary......Page 103
Exercises......Page 104
Inline CSS modification......Page 106
Basic hide and show......Page 111
Effects and speed......Page 113
Speeding in......Page 114
Sliding up and sliding down......Page 115
Compound effects......Page 116
Creating custom animations......Page 118
Building effects by hand......Page 119
Animating multiple properties at once......Page 120
Positioning with CSS......Page 122
Working with a single set of elements......Page 124
Bypassing the queue......Page 125
Manual queueing......Page 126
Working with multiple sets of elements......Page 128
Callbacks......Page 130
Summary......Page 132
Exercises......Page 133
Manipulating attributes......Page 134
Non-class attributes......Page 135
Value callbacks......Page 136
DOM element properties......Page 139
Creating new elements......Page 140
Inserting new elements......Page 141
Moving elements......Page 143
Wrapping elements......Page 145
Inverted insertion methods......Page 147
Copying elements......Page 150
Cloning for pull quotes......Page 151
Content getter and setter methods......Page 154
Further style adjustments......Page 156
DOM manipulation methods in a nutshell......Page 157
Summary......Page 158
Exercises......Page 159
Loading data on demand......Page 160
Appending HTML......Page 162
Retrieving JSON......Page 165
Global jQuery functions......Page 167
Executing a script......Page 170
Loading an XML document......Page 172
Choosing a data format......Page 175
Passing data to the server......Page 176
Performing a GET request......Page 177
Performing a POST request......Page 181
Serializing a form......Page 182
Delivering different content for
Ajax requests......Page 185
Keeping an eye on the request......Page 186
Error handling......Page 189
Ajax and events......Page 190
Security limitations......Page 191
Using JSONP for remote data......Page 193
The low-level Ajax method......Page 195
Loading parts of an HTML page......Page 196
Further reading......Page 199
Exercises......Page 200
Finding plugins and help......Page 202
Simple plugin use......Page 203
Specifying plugin method parameters......Page 205
Parameter defaults......Page 206
Custom selectors......Page 207
Global function plugins......Page 208
The jQuery UI plugin library......Page 209
Color animations......Page 210
Advanced easing......Page 211
Additional effects......Page 212
Interaction components......Page 213
Widgets......Page 215
Summary......Page 218
Exercises......Page 219
Use of the $ alias in plugins......Page 220
Adding new global functions......Page 221
Adding multiple functions......Page 223
Adding jQuery object methods......Page 226
Object method context......Page 227
Implicit iteration......Page 228
Method chaining......Page 229
Method parameters......Page 230
Parameter maps......Page 232
Default parameter values......Page 233
Callback functions......Page 234
Customizable defaults......Page 235
The jQuery UI widget factory......Page 237
Creating a widget......Page 238
Destroying widgets......Page 240
Accepting widget options......Page 241
Adding sub-methods......Page 242
Triggering widget events......Page 243
Plugin design recommendations......Page 244
Summary......Page 245
Exercises......Page 246
Selecting and traversing revisited......Page 248
Dynamic table filtering......Page 250
Table row striping......Page 252
Combining filtering and striping......Page 254
More selectors and traversal methods......Page 255
Writing a custom selector plugin......Page 256
Selector performance......Page 258
Sizzle selector implementation......Page 259
Testing selector speed......Page 260
DOM traversal under the hood......Page 261
jQuery object properties......Page 262
The DOM element stack......Page 264
Writing a DOM traversal method plugin......Page 265
Improving performance using chaining......Page 267
Improving performance using caching......Page 268
Exercises......Page 269
Events revisited......Page 272
Loading additional pages of data......Page 274
Displaying data on hover......Page 275
Event delegation......Page 277
Choosing a delegation method......Page 278
Delegating early......Page 280
Custom events......Page 281
Infinite scrolling......Page 283
Custom event parameters......Page 284
Throttling events......Page 285
Other ways to perform throttling......Page 286
Special events......Page 287
Summary......Page 289
Exercises......Page 290
Animation revisited......Page 292
Determining the animation state......Page 295
Halting a running animation......Page 296
Globally disabling all effects......Page 297
Defining effect durations......Page 298
Multi-property easing......Page 301
Deferred objects......Page 302
Animation promises......Page 303
Further reading......Page 306
Exercises......Page 307
Server-side sorting......Page 308
Ajax sorting......Page 309
JavaScript sorting......Page 310
Adding links around existing text......Page 311
Sorting simple JavaScript arrays......Page 312
Sorting DOM elements......Page 313
Storing data alongside DOM elements......Page 315
Performing additional precomputation......Page 316
Storing non-string data......Page 317
Alternating sort directions......Page 320
Using HTML5 custom data attributes......Page 321
Sorting and building rows with JSON......Page 324
Modifying the JSON object......Page 326
Rebuilding content on demand......Page 327
Shorthand element creation......Page 329
DOM manipulation hooks......Page 330
Writing a CSS hook......Page 331
Further reading......Page 333
Exercises......Page 334
Progressive enhancement with Ajax......Page 336
Harvesting JSONP data......Page 338
Ajax error handling......Page 342
Ajax promises......Page 344
Caching responses......Page 346
Throttling Ajax requests......Page 348
Data type converters......Page 349
Ajax prefilters......Page 354
Alternate transports......Page 355
Further reading......Page 359
Exercises......Page 360
Inner functions......Page 362
The great escape......Page 364
Variable scoping......Page 365
Interactions between closures......Page 367
Closures in jQuery......Page 368
Event handlers......Page 369
Binding handlers in loops......Page 371
Named and anonymous functions......Page 373
Memory leak hazards......Page 374
Accidental reference loops......Page 375
The Internet Explorer memory leak problem......Page 376
Summary......Page 377
Appendix B: Testing JavaScript with QUnit......Page 378
Setting up the document......Page 379
Organizing tests......Page 380
Adding and running tests......Page 381
Asynchronous testing......Page 384
Practical considerations......Page 385
Further reading......Page 386
Summary......Page 387
Simple CSS......Page 388
Position among matched elements......Page 389
Forms......Page 390
Filtering......Page 391
Siblings......Page 392
Collection manipulation......Page 393
Event methods......Page 394
Shorthand binding......Page 395
Shorthand triggering......Page 397
Predefined effects......Page 398
Attributes and properties......Page 399
CSS......Page 400
Dimensions......Page 401
Replacement......Page 402
Ajax methods......Page 403
Request monitoring......Page 404
Object creation......Page 405
Miscellaneous properties and functions......Page 406
Object introspection......Page 407
Other......Page 408
Index......Page 410