jQuery Mobile

jQuery Mobile是一个基于HTML5的用户界面系统,旨在制作使所有智能手机、平板电脑和台式机设备上都能访问的响应式网站和应用。(jQuery Mobile is a HTML5-based user interface system designed to make responsive web sites and apps that are accessible on all smartphone, tablet and desktop devices.)

Github stars Tracking Chart

jQuery Mobile是一个统一的、基于HTML5的用户界面系统,用于所有流行的移动设备平台,建立在坚如磐石的jQuery和jQuery UI基础之上。 它的轻量级代码是用渐进增强构建的,并且具有灵活性,易主题化设计。

jQuery Mobile 1.4.x与1.8 -- 1.11/2.1版本的jQuery核心工作。 您可以通过阅读文档并探索演示,找到有关库的工作原理及其功能的更多信息。 或者,也可以在jquerymobile站点上找到更多信息。

jQuery Mobile 主要特性:
  • 注重跨平台的HTML5
    • jQuery Mobile框架将“少写,多做”的箴言提升到一个新的水平:jQuery移动框架允许您设计一个高度品牌的响应式网站或应用程序,而不是为每个移动设备或操作系统编写独特的应用程序, 在所有流行的智能手机,平板电脑和桌面平台上工作。
  • 主题:建立品牌
    • 相信您的网站或应用应该像您的品牌,而不是任何特定的操作系统。 为了使构建高度自定义的主题变得简单,官方创建了ThemeRoller for Mobile,以便于拖放颜色和下载自定义主题。 对于没有膨胀的抛光视觉效果,jQuery Mobile 利用CSS3属性,如文本阴影和框阴影。
  • 下载构建器:自定义速度
    • 我们建议使用我们的工具来构建一个只包含所需组件的自定义包。 构建器生成自定义JavaScript文件,以及用于生产使用的完整和仅结构的样式表。

jQuery Mobile广泛支持绝大多数现代桌面、智能手机、平板电脑和电子阅读器平台。 此外,由于我们的渐进增强方法,支持功能手机和旧版浏览器。 通过对所有流行平台的广泛支持,我们对通用无障碍的承诺感到非常自豪。

Overview

Name With Ownerjquery-archive/jquery-mobile
Primary LanguageJavaScript
Program languageJavaScript (Language Count: 5)
PlatformCross-platform, Linux, Mac, Web browsers, Windows
License:Other
Release Count43
Last Release Name1.5.0-rc1 (Posted on )
First Release Name1.0a1 (Posted on )
Created At2010-09-13 15:02:22
Pushed At2021-10-07 17:23:39
Last Commit At
Stargazers Count9.7k
Watchers Count545
Fork Count2.4k
Commits Count13.1k
Has Issues Enabled
Issues Count6451
Issue Open Count169
Pull Requests Count904
Pull Requests Open Count13
Pull Requests Close Count1291
Has Wiki Enabled
Is Archived
Is Fork
Is Locked
Is Mirror
Is Private

jQuery Mobile Build Status Coverage Status

jQuery Mobile is a unified, HTML5-based user interface system for all popular mobile device platforms, built on the rock-solid jQuery and jQuery UI foundation. Its lightweight code is built with progressive enhancement, and has a flexible, easily themeable design.

jQuery Mobile 1.4.x works with versions of jQuery core from 1.8.3 to 1.11.1 / 2.1.1. You can find more information about how the library works, and what it is capable of, by reading the documentation and exploring the demos. Alternatively, more information can also be found on the jquerymobile site.

Contributing

You can contribute to the project by reporting issues, suggesting new features, or submitting pull requests.
Please read our Contributing Guidelines before submitting.

Build/Customization

Currently the library is shipped on the jQuery CDN/download as a single monolithic JavaScript file that depends on jQuery Core (not included) and a similarly bundled CSS file. For users we support the following build targets:

  • js - resolve dependencies, build, concat, and minify the JavaScript used for jQuery Mobile
  • css - resolve dependencies, build, concat, and minify all the css, just the structure css, and just the theme css
  • demos - build the js and css, and make the docs ready for static consumption
  • lint - Validates JavaScript files using JSHint

Download Builder

The easiest way to obtain a custom build is to use the download builder. With it, you can select the parts of the library you need and both the CSS and JavaScript dependencies will be resolved for you as a packaged/minified whole.

Requirements

Commands

With node and grunt installed you can run the default target by simply issuing the following from the project root:

npm install
grunt

JavaScript

As of version 1.1 the library uses dependency management in the JavaScript build by providing AMD modules which can be added or removed from the core mobile meta module js/jquery.mobile.js.

For example, if a user wished to exclude the form widgets to reduce the wire weight of their jQuery Mobile include they would first remove them from the meta module:

diff --git a/js/jquery.mobile.js b/js/jquery.mobile.js
index 6200fe6..3a4625c 100644
--- a/js/jquery.mobile.js
+++ b/js/jquery.mobile.js
@@ -19,12 +19,6 @@ define([
        './jquery.mobile.listview.filter',
        './jquery.mobile.listview.autodividers',
        './jquery.mobile.nojs',
-       './jquery.mobile.forms.checkboxradio',
-       './jquery.mobile.forms.button',
-       './jquery.mobile.forms.slider',
-       './jquery.mobile.forms.textinput',
-       './jquery.mobile.forms.select.custom',
-       './jquery.mobile.forms.select',
        './jquery.mobile.buttonMarkup',
        './jquery.mobile.controlGroup',
        './jquery.mobile.links',

And then run the build:

grunt build:js

CSS

To create a new theme:

  1. Copy the default folder from CSS/Themes to a new folder named after your new theme (eg, my-theme).

  2. Add customizations to the jquery.mobile.theme.css file.

  3. From the project root run the following grunt command:

     THEME=my-theme grunt build:css
    
  4. The output will be available in the $PROJECT_ROOT/dist

Again this assumes the theme css files are available in the css/themes/$THEME/ directory relative to the project root, css/themes/my-theme/ in the example.

Development

The root of the repository is also the root of the documentation and, along with the test suite, acts as the test bed for bug fixes and features. You'll need to set up a server and get the test suite running before you can contribute patches.

Server

Most of the documentation and testing pages rely on PHP 5+, and as a result Apache and PHP are required for development. You can install them using one of the following methods:

  • one-click - MAMP for OSX, XAMP for OSX/Windows
  • existing web server - eg, ~/Sites directory on OSX.
  • virtual machine - If Vagrant is installed you can add this remote/branch and vagrant up

In addition to vanilla Apache the following modules are required:

  • Rewrite (mod_rewrite.so)
  • Expire (mod_expires.so)
  • Header (mod_headers.so)

Once you have your web server setup you can point it at the project directory.

Testing

Automated testing forms the backbone of the jQuery Mobile project's QA activities. As a contributor or patch submitter you will be expected to run the test suite for the code your patches affect. Our continuous integration server will address the remainder of the test suite.

You can run all the test suites by running the following command:

grunt test

You can choose to run only a subset of the tests by adding the --suites option like:

grunt test --suites=table,slider

will only run the tests under tests/unit/table/ and tests/unit/slider/.

You can also exclude some tests by using !. For instance:

grunt test --type=integration --suites=\!navigation

will run all the integration tests but the navigation suite.

You can also specify which versions of jQuery you want to test jQuery Mobile by using the --jqueries option:

grunt test --jqueries=1.11.1,git

Additionally, jQuery Mobile's test suite is split between integration and unit tests. Where the unit tests are meant to focus on a single piece of the library (eg, a widget) and the integration tests require multiple pieces of the library to function. You can target either type by including the --types option when testing:

grunt test --types=unit
grunt test --types=integration
grunt test --types=unit,integration # default, equivalent to 'grunt test'
To the top