Native apps have distinct advantages, but the future belongs to mobile web apps that function on a broad range of smartphones and tablets. Get started with jQuery Mobile, the touch-optimized framework for creating apps that look and behave consistently across many devices. This concise book provides HTML5, CSS3, and JavaScript code examples, screen shots, and step-by-step guidance to help you build a complete working app with jQuery Mobile. If you're already familiar with the jQuery JavaScript library, you can use your existing skills to build cross-platform mobile web apps right now. This book shows you how. * Get a high-level overview of jQuery Mobile: how it works and how to use it * Learn about paging and navigation, including dialogs, Ajax content, and history * Employ jQuery Mobile’s extensive event system to create rich interactions * Work with toolbars, buttons, lists, forms, and other UI elements * Create a variety of visual designs with jQuery Mobile’s sophisticated theming system * Use the jQuery Mobile API for finer control over elements and interactions * Put everything together and build a mobile app from start to finish Copyright 6 Table of Contents 7 Preface 11 Introduction 11 What This Book Covers 12 What You Need To Know 12 Conventions Used In This Book 13 Using Code Examples 13 Safari庐 Books Online 14 How to Contact Us 14 Acknowledgments 15 Chapter聽1.聽Meet jQuery Mobile 17 Overview of the jQuery Mobile Library 17 How jQuery Mobile Works 18 Create Your First jQuery Mobile Application 18 Under The Hood: the jqmData() Custom Selector 23 Chapter聽2.聽Application Structure and Navigation 25 Pages 25 Internal Pages 26 External Pages 28 Overriding Asynchronous Page Fetching 30 Under The Hood: Page Initialization in jQuery Mobile 31 Page Hide and Show Events 33 Under The Hood: A jQuery Mobile Page Initialization Pattern 34 Dialogs 36 Navigation and History 36 Transitions 38 Under The Hood: Animations in a jQuery Mobile Application 39 Chapter聽3.聽Page Elements 41 Under The Hood: jQuery Plug-ins and Widgets 41 List Views 42 Basic List View 42 List View Buttons 42 List View Dividers 44 Advanced List Views 45 Nested Lists 45 List View Split Buttons 48 Thumbnails and Icons 48 Count Bubbles 52 Under The Hood: Updating a List View 55 Toolbars 55 Navigation Bars 55 Positioning the Header and Footer 59 Buttons 60 Button Control Groups 62 Button Icons 63 Custom Icons 65 Form Elements 65 Accessing Form Elements with JavaScript 65 Checkboxes and Radio Buttons 66 Methods 67 Flip Toggle 68 Methods 69 Input Fields and Textareas 69 Methods 69 Search Fields 70 Methods 70 Select Menus 71 Custom Styled Select Menus 73 Disabled Elements 73 Multiple Selections 73 Optgroups 73 Placeholders 73 Methods 75 Sliders 75 Methods 76 Layout Grids 77 Chapter聽4.聽Theming jQuery Mobile 81 Themes and Swatches 81 Under The Hood: Customizing a Swatch 90 Theming List View Elements 94 Chapter聽5.聽jQuery Mobile API 95 jQuery Mobile Methods 95 changePage 95 pageLoading 96 silentScroll 96 addResolutionBreakpoints 96 Events 97 Touch Events 97 Under The Hood: Using Swipe Events to Trigger Page Transitions 97 Initialization Events 99 Page Hide and Show Events 100 Scroll Events 101 Orientation Change Events 101 Responsive Layout API 101 CSS Selectors 101 Screen Size Breakpoint Classes 102 Orientation Change Events 103 Adding Size Breakpoints 103 Media Queries 104 Configuring jQuery Mobile 104 Available Options 104 Changing an Option via mobileinit 105 Under The Hood: Namespacing Data Attributes 106 Chapter聽6.聽jQuery Mobile in Action 109 Application Pages 109 Initializing the Application 113 The initMainPage Method 113 Under The Hood: Passing Data Between jQuery Mobile Pages 114 Accessing the Twitter API 114 JSON or XML? 114 Fetching the Data 115 The initSettings Method 118 The initDetailPage Method 119 Error Dialog 119 jqmTweet Take One 120 Improving the Interface 122 CSS Tweaks 122 Interaction Tweaks 122 Overall Approach 127 Colophon 129 Native apps have distinct advantages, but the future belongs to mobile web apps that function on a broad range of smartphones and tablets. Get started with jQuery Mobile, the touch-optimized framework for creating apps that look and behave consistently across many devices. This concise book provides HTML5, CSS3, and JavaScript code examples, screen shots, and step-by-step guidance to help you build a complete working app with jQuery Mobile. If you're already familiar with the jQuery JavaScript library, you can use your existing skills to build cross-platform mobile web apps right now. This book shows you how. Get a high-level overview of jQuery Mobile: how it works and how to use it. Learn about paging and navigation, including dialogs, Ajax content, and history. Employ jQuery Mobile's extensive event system to create rich interactions. Work with toolbars, buttons, lists, forms, and other UI elements. Create a variety of visual designs with jQuery Mobile's sophisticated theming system. Use the jQuery Mobile API for finer control over elements and interactions. Put everything together and build a mobile app from start to finish. - Publisher. Native apps have distinct advantages, but the future belongs to mobile web apps that function on a broad range of smartphones and tablets. Get started with jQuery Mobile, the touch-optimized framework for creating apps that look and behave consistently across many devices. This concise book provides HTML5, CSS3, and JavaScript code examples, screen shots, and step-by-step guidance to help you build a complete working app with jQuery Mobile.If you're already familiar with the jQuery JavaScript library, you can use your existing skills to build cross-platform mobile web apps right now. This book shows you how.Get a high-level overview of jQuery Mobile: how it works and how to use itLearn about paging and navigation, including dialogs, Ajax content, and historyEmploy jQuery Mobile’s extensive event system to create rich interactionsWork with toolbars, buttons, lists, forms, and other UI elementsCreate a variety of visual designs with jQuery Mobile’s sophisticated theming systemUse the jQuery Mobile API for finer control over elements and interactionsPut everything together and build a mobile app from start to finish The future belongs to mobile web apps that function on a broad range of smart-phones and tablets. Get started with jQuery Mobile, the touch-optimized framework for creating apps that look and behave consistently across many devices. This book assumes that you are already familiar with the jQuery JavaScript library, HTML markup, Cascading Style Sheets, and mobile web browsers. The book provides HTML5, CSS3, and JavaScript code examples, screen shots, and step-by-step guidance to help you build a complete working app