Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
jQuery Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. jQuery Part by Part
Life before jQuery
Why was jQuery created?
The major components of jQuery
The DOM selection
DOM manipulation
Events
Form
CSS and animation
Ajax
Helpers
Why are there two maintained versions of jQuery?
The difference between minified and un-minified versions
What is a content delivery network?
Summary
2. jQuery Selectors and Filters
jQuery selectors
The chapter code
Protocol-relative URLs
The jQuery object
Creating selectors
ID selectors
Class selectors
Tag selectors
Combining selectors
Descendent selectors
Attribute selectors
Creating basic filter selectors
Content filters
Using chaining to quickly and neatly continue queries
Summary
3. Manipulating the DOM
Dimensions and positions
Examples
Developer tools
Reading the size of the screen and elements
Classes and styles
The JSON object
Behavior classes
Attributes and properties
Keeping images proportional
Removing attributes and properties
Summary
4. Events
The ready event
Hooking events
Unhooking events
Namespacing events
The event handler
The event object
event.target
event.relatedTarget
event.type
event.which
event.metaKey
event.pageX and event.pageY
event.originalEvent
Passing data to an event
Event shorthand methods
Creating your own events
Triggering events
The death of the .live() and .die() methods
Looking deeper at .on()
Summary
5. Making Your Site Snazzy with jQuery
The importance of animations
Hiding and showing elements
.fadeOut()
.fadeIn()
.fadeToggle()
Sliding elements around
.slideUp()
.slideDown()
.slideToggle()
Creating custom effects
.animate()
.delay()
.queue(), .dequeue(), and .clearQueue()
.stop() and .finish()
jQuery.fx.interval and jQuery.fx.off
Using effects correctly
Summary
6. Better Forms with jQuery
Employing form methods
.submit()
.focus()
.blur()
.focusin() and .focusout()
.change()
.select()
Tooltips
Placeholder
Enabling and disabling elements
Validation
Filtering out unwanted characters
Summary
7. Talking to Your Server
Before jQuery
How jQuery helps us
Loading HTML – .load()
Loading JSON Data – .getJSON()
Loading and executing JavaScript – getScript()
Reading and writing data: jQuery.get() and .jQuery.post()
Helper methods
Creating query data – $.param()
Creating query data from a form – .serialize()
Creating an object from form data – .serializeArray()
Ajax events
When an Ajax request begins – .ajaxStart()
When an Ajax request completes – .ajaxStop()
When an Ajax request sends data – .ajaxSend()
When an Ajax request fails – .ajaxError()
When an Ajax request succeeds – .ajaxSuccess()
When an Ajax request finishes – .ajaxComplete()
Summary
8. Writing Code that You can Read Later
Separation of concerns
Breaking code into logical units
Using events to decouple code
Using unit tests
Why write unit tests at all?
Summary
9. Faster jQuery
Writing performance tests
Measuring jQuery
jQuery selectors
Using IDs over other selectors
Caching your selectors
Optimizing selectors
Right to left
Reducing overly specific selectors
Narrowing your search
Other jQuery optimizations
Updating to the latest version
Using the correct version of jQuery
Don't use deprecated methods
Using preventDefault() when appropriate
Never modify the DOM in a loop
jQuery isn't always the answer
Using document.getElementById
Using CSS
Summary
10. Benefiting from the Work of Others with Plugins
Finding plugins
Installing plugins
Updating a plugin
Uninstalling plugins
Adding a plugin
jQuery UI
jQuery UI Interactions
jQuery UI widgets
The jQuery UI widget factory
Writing your own plugin
Prep work
The plugin
Best practices
Preserve chaining
Use an IIFE
Add only one function to jQuery
Let the user theme it
Test, test, test
Document it
Minify it
Summary
Index
← Prev
Back
Next →
← Prev
Back
Next →