Jquery mobile Chinese manual Ajax development edition (1)

Source: Internet
Author: User
ArticleDirectory
    • Initialization
Initialization

Jquery mobile (hereinafter referred to as JM) automatically initializes the default configuration items during loading, so that we do not need to spend a lot of time learning and configuring these parameters, greatly improving the development efficiency.

However, in some cases, we still need to customize these parameters because of project requirements. Before learning the JM initialization parameters, we need to first understandMobileinitEvent.

Mobileinit event

The loading event of JM is different from that of the common jquery plug-in.Document. ReadyBefore the event. Therefore, when we need to adjust the default runtime parameters of JM, we need to set these parameters before the document. Ready event. jm provides usMobileinitEvents to be executed before loadingCode.

For example:

$ (Document). BIND ("mobileinit", function (){

// Apply overrides her

});

Two Methods for initializing configuration items

Method 1: Use jquery's$. ExtendMethod To set multiple configuration items

 

$ (Document). BIND ("mobileinit", function (){

$. Extend ($. Mobile ,{

Foo: bar

});

});

Method 2: set each configuration item independently

$ (Document). BIND ("mobileinit", function (){

$. Mobile. Foo = bar;

});

Initialize configuration items

The following configuration items can be initialized through the $. mobile object:

Activebtnclass (string, default: "UI-page-active "):

Set the CSS style when the button is activated.

String type. By default, the parameter is referenced in the style sheet"UI-page-active".

Coverage: trigger status of components such as buttons, list views, and select menus.

For example:

$ (Document). BIND ("mobileinit", function (){

$. Mobile. activebtnclass = "UI-BTN-hover-";

});

Define the style of the button activation status as "UI-BTN-hover-"

Activepageclass (string, default: "UI-page-active "):

Set the style of the current activation page. One JM page must have a page container that is activated, and other JM page containers will be hidden,

String type. By default, the parameter is referenced in the style sheet"UI-page-active", StyleUI-page-activeIs used to set the page to the display status style. Therefore, to customize this style, you must declare the following attributes in the style:"Display: block! Important; overflow: visible! Important ;".(Note: unfamiliarJMCSSFramework friends often encounter situations where custom styles do not work. This is generally because of custom styles and the original CSSThe inheritance relationships of the framework are different. You can add a style that does not work! ImportantTo improve the priority of custom styles)

For example:

$ (Document). BIND ("mobileinit", function (){

$. Mobile. activepageclass = "UI-page-custom ";

});

Define the style of the page activation status as "UI-page-custom", "UI-page-custom"Must define "display: block! Important; overflow: visible! Important ;"Attribute.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.