Menu
Home Explore People Places Arts History Plants & Animals Science Life & Culture Technology
On this page
jQuery Mobile
JavaScript library

jQuery Mobile is a touch-optimized web framework (also known as a mobile framework), specifically a JavaScript library, developed by the jQuery project team. The development focuses on creating a framework compatible with many smartphones and tablet computers, made necessary by the growing but heterogeneous tablet and smartphone market. The jQuery Mobile framework is consistent with other mobile app frameworks and platforms such as PhoneGap, Worklight, etc.

As of October 7, 2021 jQuery Mobile has been deprecated.

We don't have any images related to jQuery Mobile yet.
We don't have any YouTube videos related to jQuery Mobile yet.
We don't have any PDF documents related to jQuery Mobile yet.
We don't have any Books related to jQuery Mobile yet.
We don't have any archived web articles related to jQuery Mobile yet.

Features

  • Compatible with all major desktop browsers as well as all major mobile platforms, including Android, iOS, Windows Phone, Blackberry, WebOS, Symbian.
  • Built on top of jQuery core so it has a minimal learning curve for people already familiar with jQuery syntax.
  • Theming framework that allows creation of custom themes.
  • Limited dependencies and lightweight to optimize speed.
  • The same underlying codebase will automatically scale to any screen.
  • HTML5-driven configuration for laying out pages with minimal scripting.
  • AJAX-powered navigation with animated page transitions that provides ability to create semantic URLs through pushState.
  • UI widgets that are touch-optimized and platform-agnostic.

(Source: from the jQuery Mobile website)6

Example usage

$('div').on('tap', function(event){ alert('element tapped '); }); $(document).ready(function(){ $('.myList li').on('click touchstart', function() { $('.myDiv').slideDown('500'); }); });

A basic example

What follows is a basic jQuery Mobile project utilizing HTML5 semantic elements. It is important to link to the jQuery and jQuery Mobile JavaScript libraries, and stylesheet (the files can be downloaded and hosted locally, but it is recommended to link to the files hosted on the jQuery CDN).

A screen of the project is defined by a section HTML5 element, and data-role of page. Note that data-role is an example of the HTML5 data attribute, in this case being defined by jQuery Mobile. A page may have header and footer elements with data-role of header and footer, respectively. In between, there may be an article element, with a role of main and a class of ui-content. Lastly, a nav element, with data-role of navbar may be present.

One HTML document can contain more than one section element, and thus more than one screenful of content. This way it is only necessary to load one file which includes multiple pages of content. One page can link to another page within the same file by referencing the page's id attribute (e.g. href="#second").

In the example below, two other data- attributes are used. The data-theme attribute tells the browser what theme to render. The data-add-back-btn attribute adds a back button to the page if set to true.

Lastly, icons can be added to elements via the data-icon attribute. jQuery Mobile has fifty commonly-used icons built in.

A brief explanation of the Data Attributes used in this example:

data-role – Specifies the role of the element, such as header, content, footer, etc.

data-theme – Specifies which design theme to use for elements within a container. Can be set to: a or b.

data-position – Specifies whether the element should be fixed, in which case it will render at the top (for header) or bottom (for footer).

data-transition – Specifies one of ten built-in animations to use when loading new pages.

data-icon – Specifies one of fifty built-in icons that can be added to an element.

<!doctype html> <html> <head> <meta charset="utf-8"> <title>jQuery Mobile Example</title> <meta name="viewport" content="initial-scale=1, user-scalable=no, width=device-width"> <link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> </head> <body> <section data-role="page" id="first" data-theme="a"> <header data-role="header" data-position="fixed"> <h1>Page 1 Header</h1> </header> <article role="main" class="ui-content"> <h2>Hello, world!</h2> <a href="#second" data-role="button" data-inline="true" data-transition="flow" data-icon="carat-r" data-iconpos="right">Go to Page 2</a> </article> <footer data-role="footer" data-position="fixed"> <h4>Page 1 Footer</h4> </footer> </section> <section data-role="page" id="second" data-theme="b"> <header data-role="header" data-position="fixed" data-add-back-btn="true"> <h1>Page 2 Header</h1> </header> <article role="main" class="ui-content"> <h2>Example Page</h2> </article> <footer data-role="footer" data-position="fixed"> <h4>Page 2 Footer</h4> </footer> </section> <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script> <script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> </body> </html>

Theming

jQuery Mobile provides a theming framework that allows developers to customize color schemes and certain CSS aspects of UI features. Developers can use the jQuery Mobile ThemeRoller7 application to customize these appearances and create branded experiences. After developing a theme in the ThemeRoller application, programmers can download a custom CSS file and include it in their project to use their custom theme.8

Each theme can contain up to 26 unique color "swatches," each of which consists of a header bar, content body, and button states. Combining different swatches allows developers to create a wider range of visual effects than they would be able to with just one swatch per theme. Switching between different swatches within a theme is as simple as adding an attribute called "data-theme" to HTML elements.

The default jQuery Mobile theme comes with two different color swatches, named "a" and "b". Here is an example of how to create a toolbar with the "b" swatch:

<div data-role="header" data-theme="b"> <h1>Page Title</h1> </div>

(Source: from the jQuery Mobile website)9

There are already a handful of open source style themes that are developed and supported by third-party organizations. One such open source style theme is the Metro style theme that was developed and released by Microsoft Open Technologies, Inc.10 The Metro style theme is meant to mimic the UI of the Metro (design language) that Microsoft uses in its mobile operating systems.

Mobile browser support

PlatformVersionNativePhone GapOpera MobileOpera MiniFennecOzoneNet front
0.98.5, 8.659.5104.05.01.01.1*0.94.0
iOSv2.2.1AA
v3.1.3, v3.2AAA
v4-7.0AAA
Symbian S60v3.1, v3.2AAAAACC
v5.0CCCACA
Symbian UIQv3.0, v3.1C 8.65C
v3.2CC
Symbian Platformv.3.0A
BlackBerry OSv4.5CCC
v4.6, v4.7CCCB
v5.0BACA
v6.0AAA
Androidv1.5, v1.6AA
v2.1AA
v2.2AAA*C*A*
Windows Mobilev6.1CCCCBCBC
v6.5.1CCCAACA
v7.0AACA
webOS1.4.1AA
bada1.0A
Maemo5.0BBCB*
MeeGo1.1*A*A*A*

Key:

  • A - High Quality. A browser that’s capable of, at minimum, utilizing media queries (a requirement for jQuery Mobile). These browsers will be actively tested against, but may not receive the full capabilities of jQuery Mobile.
  • B - Medium Quality. A capable browser that doesn’t have enough market share to warrant day-to-day testing. Bug fixes will still be applied to help these browsers.
  • C - Low Quality. A browser that is not capable of utilizing media queries. They will not be provided any jQuery Mobile scripting or CSS (falling back to plain HTML and simple CSS).
  • * - Upcoming browser. This browser is not yet released but is in alpha/beta testing.

(Source: from the jQuery Mobile website)11

See also

  • Free and open-source software portal

Further reading

References

  1. "Mobile Graded Browser Support". https://jquerymobile.com/gbs/

  2. "The Global Rise of the Smartphone". Archived from the original on 2018-06-17. Retrieved 2011-04-27. https://web.archive.org/web/20180617042807/https://gigaom.com/2010/04/30/the-global-rise-of-the-smartphone/

  3. "Resons why jQuery Mobile Is Suitable For Mobile Web App Development". http://www.htmlpanda.com/blog/why-jquery-mobile-is-suitable-for-mobile-web-app-development/

  4. "IBM Worklight - United States". Worklight.com. Retrieved 2013-10-09. http://www.worklight.com

  5. "jQuery maintainers continue modernization initiative with deprecation of jQuery Mobile". jQuery Blog. Retrieved 6 December 2022. https://blog.jquery.com/2021/10/07/jquery-maintainers-continue-modernization-initiative-with-deprecation-of-jquery-mobile//

  6. "Mobile Graded Browser Support". https://jquerymobile.com/gbs/

  7. "ThemeRoller". https://jquerymobile.com/themeroller/

  8. "JQuery Mobile Theming Overview". https://jquerymobile.com/test/docs/api/themes.html

  9. "Mobile Graded Browser Support". https://jquerymobile.com/gbs/

  10. "More news from MS Open Tech: announcing the open source Metro style theme for jQuery Mobile". Archived from the original on 2014-08-16. https://web.archive.org/web/20140816185609/http://blogs.msdn.com/b/interoperability/archive/2012/04/26/more-news-from-ms-open-tech-announcing-the-open-source-metro-style-theme.aspx

  11. "Mobile Graded Browser Support". https://jquerymobile.com/gbs/