Learning jQuery: A Hands-on Guide to Building Rich Interactive Web Frontends

Learning jQuery: A Hands-on Guide to Building Rich Interactive Web Frontends

By: Ralph Steyer (author)Paperback

2 - 4 weeks availability

Description

Get started fast with jQuery web programming The jQuery JavaScript library greatly simplifies the creation of modern, rich web applications, while seamlessly integrating with virtually all leading web development platforms and frameworks. Learning jQuery will guide you through using jQuery, jQuery UI, and jQuery Mobile in your own projects. One step at a time, you'll learn how to do everything from adding simple effects through building complete rich Internet applications. This code-rich tutorial is designed for every working web developer. After clearly explaining all the basics, Ralph Steyer shows how to apply jQuery to create effects, animations, slideshows, lists, drag-and-droppable elements, interactive forms, and much more. If you're a web developer with even basic JavaScript experience, Learning jQuery is your fastest route to success with jQuery * Discover what jQuery can do, and how it works with JavaScript and DOM * Select components to support dynamic processes * Manipulate web page content and structure * Apply and change formatting with CSS style sheets through jQuery * Handle complex events more effectively and reliably * Generate time-dependent and time-independent CSS effects * Expand jQuery's capabilities with plug-ins * Use jQuery to create simpler, better, more powerful AJAX code * Master powerful, flexible jQuery UI plug-ins for visual control and user interaction * Simplify the creation of jQuery UI interfaces with ThemeRoller * Master basic rules for successfully working with components and widgets * Construct touch-enabled mobile front ends with jQuery Mobile

Create a review

About Author

Ralph Steyer is a computer programmer, consultant, journalist, and book author with decades of experience in a wide variety of computer programming languages and technologies. He has a degree in mathematics from Frankfurt/Main University and is the author of several books on web programming, including JavaScript Handbook and AJAX Frameworks (Addison-Wesley).

Contents

1 Introduction 1 1.1 What Is This Book About? 2 1.1.1 What You Can Learn from This Book 4 1.2 Writing Conventions 5 1.3 Who Is the Target Audience for This Book? 6 1.4 What Do You Need? 6 1.4.1 Hardware and Operating System 6 1.4.2 jQuery and jQuery UI 7 1.4.3 The Browsers 9 1.4.4 Different Operating Systems and Virtual Machines for Testing 10 1.4.5 The Web Server for Realistic Testing 11 1.4.6 The Development Tools 13 1.5 About the Author 16 2 First Examples with jQuery 17 2.1 Accessing Elements and Protecting the DOM 17 2.2 Editing the Web Page with DHTML a la jQuery 22 2.3 Animatedly Reducing and Enlarging of an Element 25 2.4 Changing Attributes Dynamically 28 3 Basic Knowledge 31 3.1 The Web, Web 2.0, and the Client/Server Principle on the Internet 32 3.1.1 Programming on the Web 32 3.1.2 The Web 2.0 33 3.2 JavaScript and Its Relationship to jQuery 33 3.2.1 The General Integration of JavaScript in Websites 34 3.3 AJAX and XMLHttpRequest (XHR) 37 XML 38 JSON 41 More Details on Processing JSON for JavaScript Pros 43 3.4 DOM and Objects 46 3.5 Style Sheets and DHTML 48 3.5.1 CSS: The Web's Standard Language 48 3.5.2 The Specific Syntax of CSS Declarations 50 3.5.3 Selectors 50 4 How jQuery Works 51 4.1 Accessing Elements of the Web Page 52 4.2 The jQuery Namespace and the jQuery Object 54 4.3 Special Data Types and Structures in jQuery 55 4.3.1 Options 55 4.3.2 Map 56 4.3.3 The Array Notation 56 4.3.4 jqXHR 57 4.4 The Function jQuery() and the Alias $() 57 4.4.1 The Context 59 4.5 Executing Functions After DOM Has Been Built 60 4.5.1 Callback or Anonymous Function as a Parameter of jQuery() 60 4.5.2 Placing document.ready() into an External JavaScript File 63 4.5.3 Example of Creating a Basic Structure for a Modularized jQuery Web Application 63 4.6 Creating an Element with jQuery() and Inserting It into the Web Page 66 4.6.1 Options for Initializing Attributes 68 4.7 Wrapping Existing Elements with jQuery() 70 4.7.1 Direct Access to DOM elements via get( ) 71 4.8 Using jQuery in Combination with Other Frameworks 72 4.8.1 The Function noConflict() 73 4.9 More About Context 74 4.9.1 context, selector, and nodeName 75 4.10 Chaining jQuery Objects 77 4.10.1 Executing Function Calls Sequentially: The jQuery Queue 78 4.11 New Core Techniques Since Version 1.5 78 4.11.1 jQuery.sub() 78 4.11.2 jQuery.when() 79 4.11.3 Version 1.6: What's New? 79 attr(), prop(), and removeProp() 80 data() 81 5 Selectors and Filters 83 5.1 The Basics 84 5.1.1 What Is a Selector? 84 5.1.2 What Are Filters? 84 5.1.3 XPath as Basis 85 5.2 The Basic Selectors and the Hierarchical Selectors 86 5.2.1 Examples 88 5.2.2 Potential Pitfalls 97 5.3 Filtering Selectors 99 5.3.1 Basic Filters 99 5.3.2 Content Filters 106 5.3.3 Visibility Filters 109 5.3.4 Child Filters 112 5.3.5 Attribute Filters 114 5.3.6 Filters for Form Elements and Form Filters 118 5.4 Filter Methods 123 5.4.1 eq() 123 5.4.2 not() 123 5.4.3 first() and last() 124 5.4.4 slice() 124 5.4.5 filter() 125 5.4.6 is() 126 5.4.7 map() 127 6 Accessing the Elements of a Web Page 131 6.1 General Info on Checking, Changing, Adding, and Removing Nodes 131 6.2 Checking and Changing Node Contents: html() and text() 132 6.3 Content of Form Fields: val() 135 6.4 Accessing Attributes via attr() 137 6.5 Inserting Nodes into a Web Page 137 6.5.1 append() and prepend() 138 6.5.2 appendTo() and prependTo() 143 6.6 Inserting Nodes Before or After 148 6.6.1 after() and before() 149 6.6.2 insertAfter() and insertBefore() 152 6.7 Wrapping 154 6.7.1 Wrapping Individually with wrap() 154 6.7.2 Wrapping All with wrapAll() 156 6.7.3 Wrapping Inner Areas with wrapInner() 158 6.7.4 Unwrapping with unwrap() 159 6.8 Replacing with replaceWith() and replaceAll() 159 6.8.1 Replacing with replaceWith() 160 6.8.2 Replacing All with replaceAll() 164 6.9 Removing with empty() and remove()/detach() plus removeAttr() 166 6.9.1 The Alternative of remove(): detach() 171 6.9.2 Deleting Attributes 171 6.10 Cloning with clone() 172 6.11 Search and Find 176 6.11.1 Of Children and Parents: children() and parent() plus parents()/parentsUntil() 176 6.11.2 offsetParent() and closest() 180 6.11.3 Siblings 182 6.11.4 Searching Descendants with has() 184 6.12 Finding with find() and contents() 184 6.13 The jQuery Method each() for Iterating over Arrays and Objects 186 6.13.1 jQuery.each() 188 6.13.2 The Method each() 192 6.14 The add() Method 193 6.14.1 The end() and andSelf() Methods 195 6.15 A More Comprehensive Example at the End: A Date Component 196 7 Formatting with Style Sheets Under jQuery 205 7.1 The css() Method 206 7.1.1 Getting Style Properties 206 7.1.2 Setting Properties 207 7.2 Changing Classes of Elements 209 7.2.1 Adding Classes: addClass() 210 7.2.2 Removing Classes: removeClass() 218 7.2.3 Toggling Classes with toggleClass() 219 7.2.4 Testing for a Class: hasClass() 221 7.3 Positioning Methods 223 7.3.1 Determining the Position with position() 224 7.3.2 Position in Relation to the Document: offset() 228 7.4 Scrolling Methods 236 7.5 Height and Width 239 7.5.1 height() and width() 239 7.6 Inner and Outer Dimensions 242 8 Event Handling Under jQuery 247 8.1 Basic Information on Events, Event Handlers, Triggers, and Data Binding 247 8.1.1 Events 247 8.1.2 General Information on Event Handlers 248 8.1.3 HTML Event Handlers 248 8.1.4 JavaScript Event Handler 249 8.1.5 The Event Object 250 8.1.6 Bubbling 251 8.1.7 Data Binding 251 8.1.8 Trigger 252 8.2 The Event Object in jQuery 252 8.2.1 The Constructor of jQuery.Event 252 8.2.2 The Properties of the Event Object jQuery.Event 253 8.2.3 The Methods of an Object of the Type jQuery.Event 256 8.3 Ready, Steady, Go: $(document).ready() 258 8.4 Event Helpers 258 8.5 Expanded Methods for Event Handling 262 8.5.1 The bind() and unbind() Methods 262 8.5.2 The One and Only: one() 266 8.5.3 The Method trigger() 267 8.5.4 triggerHandler() 269 8.5.5 Live Events: The live() and die() Methods plus delegate() and undelegate() 270 8.5.6 Auxiliary Functions for Interaction 274 9 Effects and Animations 279 9.1 Basic Use 279 9.1.1 Speed Is All You Need 279 9.1.2 Specifying a Callback 280 9.1.3 Chaining 281 9.1.4 Queues 281 9.1.5 Stopping via stop() and jQuery.fx.off 282 9.1.6 Endless Animations 282 9.1.7 Types of Animation 282 9.2 Showing and Hiding: The show() and hide() Methods 283 9.3 Sliding Effects: slideDown(), slideUp(), and slideToggle() 284 9.4 Opacity Effects: fadeIn(), fadeOut(), and fadeTo() (Plus toggle()) 287 9.5 Individual Animations with animate() 289 10 AJAX 297 10.1 AJAX and XMLHttpRequest (XHR) Basics 297 10.1.1 Creating an XMLHttpRequest Object Manually 298 10.1.2 The Methods of an XHR Object 299 10.1.3 The Properties of an XHR Object 300 10.1.4 A Practical Example of Data Request Without Special jQuery Methods 300 10.1.5 The Data Format in an AJAX Communication 302 10.1.6 AJAX Request Process 303 10.2 Special AJAX Support in jQuery 304 10.2.1 JSONP and Remote Requests 304 10.2.2 The jqXHR Object 305 10.2.3 Methods in jQuery for AJAX Requests 305 10.2.4 Specifying the Data Type 305 10.2.5 Avoiding Caching 307 10.3 $.get() and $.post() 307 10.3.1 Just Requesting Plain Text from the Web Server 307 10.3.2 Sending Data to the Web Server via $.get() and $.post() 309 10.3.3 Getting and Parsing XML Data 312 10.4 Getting and Parsing JSON Data: getJSON() and parseJSON() 316 10.4.1 A Simple Application with JSON 316 10.4.2 Requesting Twitter Tweets via JSONP 317 10.5 Loading a Script Later via AJAX: jQuery.getScript() 320 10.6 The General Variation for Loading Data: load() 322 10.6.1 Specifying Filters 323 10.7 Serializing Data 327 10.7.1 The serialize() Method 327 10.7.2 The serializeArray() Method 329 10.7.3 The General Version: param() 329 10.8 Default Values for AJAX 330 10.9 AJAX Events and AJAX Event Handlers 330 10.9.1 Local Events 330 10.9.2 Global Events 332 10.10 Complete Control 333 10.10.1 jQuery.ajax() 333 10.10.2 A JSONP Request 339 10.10.3 Loading and Executing a JavaScript File 340 10.10.4 Sending Data Plus Evaluating the Success 340 10.10.5 Extended Techniques for $.ajax() 341 11 jQuery UI 345 11.1 What Is jQuery UI? 345 11.1.1 Components for Supporting Interaction 346 11.1.2 Widgets 346 11.1.3 Extended Effects 347 11.1.4 The Theme Framework and ThemeRoller 347 11.2 Getting Started 348 11.3 How Is jQuery UI Used? 349 11.3.1 Downloading and ThemeRoller 349 11.3.2 Using jQuery UI on a Web Page 353 11.3.3 A Sample Web Page for jQuery UI 355 11.4 Using the Components in jQuery UI 355 11.4.1 The Default Setting 356 11.4.2 Some Basic Rules on Components and Widgets 358 11.4.3 Properties/Options of Components 359 11.4.4 Methods of Components 363 11.4.5 Events in Components and Widgets 366 11.5 An Overview of the Components and Widgets 370 11.5.1 The Interaction Components 370 11.5.2 The Widgets 372 11.5.3 Utilities 385 11.6 Effects 385 11.6.1 The effect() Method 385 11.6.2 Color Animations with animate() 386 11.7 A Complete Website Based on jQuery UI 387 12 Plug-Ins 393 12.1 The jQuery Plug-In Page 393 12.1.1 Searching For and Using an Existing Plug-In 394 12.1.2 Validation Plug-Ins 397 12.2 Creating Custom Plug-Ins 405 12.2.1 Why Create Custom Plug-Ins? 405 12.2.2 Creating Your First Plug-In 405 12.2.3 The Main Rules for Creating a Simple Plug-In 409 12.2.4 Rules for Creating More Complex Plug-Ins 409 12.2.5 An Example for a Plug-In with Options 411 12.2.6 Another Example for a Plug-In with Options 413 12.3 Publishing a Plug-In 415 13 jQuery Mobile 417 13.1 Basics 417 13.1.1 The Platforms 419 13.1.2 Downloading and Integrating the Framework 420 13.1.3 Alternatives 421 13.2 The Role System and data-role 422 13.3 The Basic Structure of a Mobile Web Page 422 13.4 Linking Pages 424 13.4.1 External Links via Hijax 424 13.4.2 Internal Links and the Special Interpretation of a Page 425 13.5 The Transitions 428 13.6 Dialogs 428 13.7 Buttons 429 13.7.1 Buttons with Icons 430 13.7.2 Block Element or Inline Element 431 13.7.3 Grouping 431 13.7.4 A Practical Example 432 13.8 Toolbars and Navigation Bars 435 13.9 Lists 439 13.10 Form Elements 443 13.10.1 Field Containers 444 13.10.2 The Various Form Elements 444 13.10.3 Plug-In Methods for Form Elements 447 13.10.4 Sending the Form Data 448 13.11 Special Events 448 13.11.1 Touch Events 448 13.11.2 Orientation Change 448 13.11.3 Scroll Events 449 13.11.4 Page Events 449 13.12 The Theme Framework and General Content Design 452 13.13 Collapsed and Expanded Content 454 Appendix 457 TOC, 9780321815262, 4/10/2013

Product Details

  • publication date: 26/04/2013
  • ISBN13: 9780321815262
  • Format: Paperback
  • Number Of Pages: 512
  • ID: 9780321815262
  • weight: 792
  • ISBN10: 0321815262

Delivery Information

  • Saver Delivery: Yes
  • 1st Class Delivery: Yes
  • Courier Delivery: Yes
  • Store Delivery: Yes

Prices are for internet purchases only. Prices and availability in WHSmith Stores may vary significantly

Close