jQuery Cookbook(影印版)
jQuery Cookbook(影印版)
jQuery Community Experts 著
出版时间:2010年12月
页数:451
jQuery简化了丰富的、交互Web前端的构建过程。学会上手这个 JavaScript库不难,但是若要全面掌握、深入理解,恐怕得花费多年时间。本书合理地缩短了学习曲线。在各个章节中,你将从很多领先的开发者那里学习模式和实践,他们到处使用jQuery,从将简单组件整合进网站到开发复杂的高性能用户界面。
作为JavaScript新手和行家的理想选择,《jQuery Cookbook》从基础知识开始,然后转向实际用例,包括经验证的解决方案和常见的Web开发障碍。你还能看到高级议题相关章节,如将jQuery应用到大型项目中去的方法等。

· 解决包括事件、效果、维度、表单、主题以及用户界面元素等在内的各种问题
· 学习如何优化表单,以及如何在页面上定位和重定位元素
· 最大化运用jQuery的事件管理系统,包括定制事件和定制事件数据
· 创建UI元素——包括标签、折叠、模态——从头做起
· 优化代码以减少瓶颈并保证高峰性能
· 学习如何测试jQuery应用
· 应用jQuery UI CSS框架和主题

“我喜欢看到一个此前熟知的API,转而通过另外一种又新奇又有趣的方式得以运用。我希望此书对你有用,教会你以新奇而有趣的方式来使用 jQuery。”
—— John Resig,jQuery库创建者

读者应具备JavaScript编程经验。
  1. Foreword
  2. Contributors
  3. Preface
  4. 1. jQuery Basics
  5. 1.1 Including the jQuery Library Code in an HTML Page
  6. 1.2 Executing jQuery/JavaScript Coded After the DOM Has Loaded
  7. but Before Complete Page Load
  8. 1.3 Selecting DOM Elements Using Selectors and the jQuery Function
  9. 1.4 Selecting DOM Elements Within a Specified Context
  10. 1.5 Filtering a Wrapper Set of DOM Elements
  11. 1.6 Finding Descendant Elements Within the Currently Selected
  12. Wrapper Set
  13. 1.7 Returning to the Prior Selection Before a Destructive Change
  14. 1.8 Including the Previous Selection with the Current Selection
  15. 1.9 Traversing the DOM Based on Your Current Context to Acquire a
  16. New Set of DOM Elements
  17. 1.10 Creating, Operating on, and Inserting DOM Elements
  18. 1.11 Removing DOM Elements
  19. 1.12 Replacing DOM Elements
  20. 1.13 Cloning DOM Elements
  21. 1.14 Getting, Setting, and Removing DOM Element Attributes
  22. 1.15 Getting and Setting HTML Content
  23. 1.16 Getting and Setting Text Content
  24. 1.17 Using the $ Alias Without Creating Global Conflicts
  25. 2. Selecting Elements with jQuery
  26. 2.1 Selecting Child Elements Only
  27. 2.2 Selecting Specific Siblings
  28. 2.3 Selecting Elements by Index Order
  29. 2.4 Selecting Elements That Are Currently Animating
  30. 2.5 Selecting Elements Based on What They Contain
  31. 2.6 Selecting Elements by What They Don’t Match
  32. 2.7 Selecting Elements Based on Their Visibility
  33. 2.8 Selecting Elements Based on Attributes
  34. 2.9 Selecting Form Elements by Type
  35. 2.10 Selecting an Element with Specific Characteristics
  36. 2.11 Using the Context Parameter
  37. 2.12 Creating a Custom Filter Selector
  38. 3. Beyond the Basics
  39. 3.1 Looping Through a Set of Selected Results
  40. 3.2 Reducing the Selection Set to a Specified Item
  41. 3.3 Convert a Selected jQuery Object into a Raw DOM Object
  42. 3.4 Getting the Index of an Item in a Selection
  43. 3.5 Making a Unique Array of Values from an Existing Array
  44. 3.6 Performing an Action on a Subset of the Selected Set
  45. 3.7 Configuring jQuery Not to Conflict with Other Libraries
  46. 3.8 Adding Functionality with Plugins
  47. 3.9 Determining the Exact Query That Was Used
  48. 4. jQuery Utilities
  49. 4.1 Detecting Features with jQuery.support
  50. 4.2 Iterating Over Arrays and Objects with jQuery.each
  51. 4.3 Filtering Arrays with jQuery.grep
  52. 4.4 Iterating and Modifying Array Entries with jQuery.map
  53. 4.5 Combining Two Arrays with jQuery.merge
  54. 4.6 Filtering Out Duplicate Array Entries with jQuery.unique
  55. 4.7 Testing Callback Functions with jQuery.isFunction
  56. 4.8 Removing Whitespace from Strings or Form Values with
  57. jQuery.trim
  58. 4.9 Attaching Objects and Data to DOM with jQuery.data
  59. 4.10 Extending Objects with jQuery.extend
  60. 5. Faster, Simpler, More Fun
  61. 5.1 That’s Not jQuery, It’s JavaScript!
  62. 5.2 What’s Wrong with $(this)?
  63. 5.3 Removing Redundant Repetition
  64. 5.4 Formatting Your jQuery Chains
  65. 5.5 Borrowing Code from Other Libraries
  66. 5.6 Writing a Custom Iterator
  67. 5.7 Toggling an Attribute
  68. 5.8 Finding the Bottlenecks
  69. 5.9 Caching Your jQuery Objects
  70. 5.10 Writing Faster Selectors
  71. 5.11 Loading Tables Faster
  72. 5.12 Coding Bare-Metal Loops
  73. 5.13 Reducing Name Lookups
  74. 5.14 Updating the DOM Faster with .innerHTML
  75. 5.15 Debugging? Break Those Chains
  76. 5.16 Is It a jQuery Bug?
  77. 5.17 Tracing into jQuery
  78. 5.18 Making Fewer Server Requests
  79. 5.19 Writing Unobtrusive JavaScript
  80. 5.20 Using jQuery for Progressive Enhancement
  81. 5.21 Making Your Pages Accessible
  82. 6. Dimensions
  83. 6.1 Finding the Dimensions of the Window and Document
  84. 6.2 Finding the Dimensions of an Element
  85. 6.3 Finding the Offset of an Element
  86. 6.4 Scrolling an Element into View
  87. 6.5 Determining Whether an Element Is Within the Viewport
  88. 6.6 Centering an Element Within the Viewport
  89. 6.7 Absolutely Positioning an Element at Its Current Position
  90. 6.8 Positioning an Element Relative to Another Element
  91. 6.9 Switching Stylesheets Based on Browser Width
  92. 7. Effects
  93. 7.1 Sliding and Fading Elements in and out of View
  94. 7.2 Making Elements Visible by Sliding Them Up
  95. 7.3 Creating a Horizontal Accordion
  96. 7.4 Simultaneously Sliding and Fading Elements
  97. 7.5 Applying Sequential Effects
  98. 7.6 Determining Whether Elements Are Currently Being Animated
  99. 7.7 Stopping and Resetting Animations
  100. 7.8 Using Custom Easing Methods for Effects
  101. 7.9 Disabling All Effects
  102. 7.10 Using jQuery UI for Advanced Effects
  103. 8. Events
  104. 8.1 Attaching a Handler to Many Events
  105. 8.2 Reusing a Handler Function with Different Data
  106. 8.3 Removing a Whole Set of Event Handlers
  107. 8.4 Triggering Specific Event Handlers
  108. 8.5 Passing Dynamic Data to Event Handlers
  109. 8.6 Accessing an Element ASAP (Before document.ready)
  110. 8.7 Stopping the Handler Execution Loop
  111. 8.8 Getting the Correct Element When Using event.target
  112. 8.9 Avoid Multiple hover() Animations in Parallel
  113. 8.10 Making Event Handlers Work for Newly Added Elements
  114. 9. Advanced Events
  115. 9.1 Getting jQuery to Work When Loaded Dynamically
  116. 9.2 Speeding Up Global Event Triggering
  117. 9.3 Creating Your Own Events
  118. 9.4 Letting Event Handlers Provide Needed Data
  119. 9.5 Creating Event-Driven Plugins
  120. 9.6 Getting Notified When jQuery Methods Are Called
  121. 9.7 Using Objects’ Methods as Event Listeners
  122. 10. HTML Form Enhancements from Scratch
  123. 10.1 Focusing a Text Input on Page Load
  124. 10.2 Disabling and Enabling Form Elements
  125. 10.3 Selecting Radio Buttons Automatically
  126. 10.4 (De)selecting All Checkboxes Using Dedicated Links
  127. 10.5 (De)selecting All Checkboxes Using a Single Toggle
  128. 10.6 Adding and Removing Select Options
  129. 10.7 Autotabbing Based on Character Count
  130. 10.8 Displaying Remaining Character Count
  131. 10.9 Constraining Text Input to Specific Characters
  132. 10.10 Submitting a Form Using Ajax
  133. 10.11 Validating Forms
  134. 11. HTML Form Enhancements with Plugins
  135. 11.1 Validating Forms
  136. 11.2 Creating Masked Input Fields
  137. 11.3 Autocompleting Text Fields
  138. 11.4 Selecting a Range of Values
  139. 11.5 Entering a Range-Constrained Value
  140. 11.6 Uploading Files in the Background
  141. 11.7 Limiting the Length of Text Inputs
  142. 11.8 Displaying Labels Above Input Fields
  143. 11.9 Growing an Input with Its Content
  144. 11.10 Choosing a Date
  145. 12. jQuery Plugins
  146. 12.1 Where Do You Find jQuery Plugins?
  147. 12.2 When Should You Write a jQuery Plugin?
  148. 12.3 Writing Your First jQuery Plugin
  149. 12.4 Passing Options into Your Plugin
  150. 12.5 Using the $ Shortcut in Your Plugin
  151. 12.6 Including Private Functions in Your Plugin
  152. 12.7 Supporting the Metadata Plugin
  153. 12.8 Adding a Static Function to Your Plugin
  154. 12.9 Unit Testing Your Plugin with QUnit
  155. 13. Interface Components from Scratch
  156. 13.1 Creating Custom Tool Tips
  157. 13.2 Navigating with a File-Tree Expander
  158. 13.3 Expanding an Accordion
  159. 13.4 Tabbing Through a Document
  160. 13.5 Displaying a Simple Modal Window
  161. 13.6 Building Drop-Down Menus
  162. 13.7 Cross-Fading Rotating Images
  163. 13.8 Sliding Panels
  164. 14. User Interfaces with jQuery UI
  165. 14.1 Including the Entire jQuery UI Suite
  166. 14.2 Including an Individual jQuery UI Plugin or Two
  167. 14.3 Initializing a jQuery UI Plugin with Default Options
  168. 14.4 Initializing a jQuery UI Plugin with Custom Options
  169. 14.5 Creating Your Very Own jQuery UI Plugin Defaults
  170. 14.6 Getting and Setting jQuery UI Plugin Options
  171. 14.7 Calling jQuery UI Plugin Methods
  172. 14.8 Handling jQuery UI Plugin Events
  173. 14.9 Destroying a jQuery UI Plugin
  174. 14.10 Creating a jQuery UI Music Player
  175. 15. jQuery UI Theming
  176. 15.1 Styling jQuery UI Widgets with ThemeRoller
  177. 15.2 Overriding jQuery UI Layout and Theme Styles
  178. 15.3 Applying a Theme to Non-jQuery UI Components
  179. 15.4 Referencing Multiple Themes on a Single Page
  180. 15.5 Appendix: Additional CSS Resources
  181. 16. jQuery, Ajax, Data Formats: HTML, XML, JSON, JSONP
  182. 16.1 jQuery and Ajax
  183. 16.2 Using Ajax on Your Whole Site
  184. 16.3 Using Simple Ajax with User Feedback
  185. 16.4 Using Ajax Shortcuts and Data Types
  186. 16.5 Using HTML Fragments and jQuery
  187. 16.6 Converting XML to DOM
  188. 16.7 Creating JSON
  189. 16.8 Parsing JSON
  190. 16.9 Using jQuery and JSONP
  191. 17. Using jQuery in Large Projects
  192. 17.1 Using Client-Side Storage
  193. 17.2 Saving Application State for a Single Session
  194. 17.3 Saving Application State Between Sessions
  195. 17.4 Using a JavaScript Template Engine
  196. 17.5 Queuing Ajax Requests
  197. 17.6 Dealing with Ajax and the Back Button
  198. 17.7 Putting JavaScript at the End of a Page
  199. 18. Unit Testing
  200. 18.1 Automating Unit Testing
  201. 18.2 Asserting Results
  202. 18.3 Testing Synchronous Callbacks
  203. 18.4 Testing Asynchronous Callbacks
  204. 18.5 Testing User Actions
  205. 18.6 Keeping Tests Atomic
  206. 18.7 Grouping Tests
  207. 18.8 Selecting Tests to Run
  208. Index
书名:jQuery Cookbook(影印版)
作者:jQuery Community Experts 著
国内出版社:东南大学出版社
出版时间:2010年12月
页数:451
书号:978-7-5641-2415-1
原版书出版商:O'Reilly Media
jQuery Community Experts
 
The animal on the cover of the jQuery Cookbook is an ermine (Mustela erminea), also
known as a stoat. “Ermine” sometimes refers to the animal’s white winter fur, and
“stoat” to the brown fur it has during the rest of the year. It belongs to the weasel family,
which includes martens, ferrets, minks, otters, and polecats, though it is distinguished
from these other members by its black-tipped tail.
The ermine lives in northern woodland regions of Europe, Asia, and North America.
It is mainly nocturnal and makes dens in tree roots, under stones, and in tunnels. A
solitary animal, the ermine can travel up to 10 miles in one night searching for food.
Its predators include foxes, badgers, cats, and birds of prey.
The ermine’s slender body helps it run swiftly, even across snow, as well as climb and
swim. Although this shape has advantages, it also causes the ermine to quickly lose
heat from its body. Thick fur and a fast metabolism help compensate, and the ermine
must eat daily to meet its energy demands. Its diet includes small mammals, birds, fish,
and insects. When the ermine spots its prey, it sneaks up on it in a series of leaps, grasps
the victim’s neck, and kills it with repeated bites.
White ermine fur is highly prized and is used in trimming coats, although demand has
dropped in recent years. Typically, several furs are sewn together to form a pattern of
black dots on a white field. This pattern was imitated in heraldry—the design of coats
of arms—as early as the 12th century, most famously in the arms of Brittany. Ermine
fur is also a symbol of royalty or purity, which is perhaps why Elizabeth I of England,
“the Virgin Queen,” was painted with an ermine by her side.