Article Introduction: Let's take a look at some of the properties of jquery Mobile. |
In this article, let's take a look at some of the properties of jquery Mobile
(Note: The code snippet in the following example is from version 1.1.0)
First, explain the concept of each view or page in jquery Mobile:
How do you define a page container?
From the previous tutorial, you should have read the following code:
A separate page <div data-role= "page" ></div> //Multiple page <div data-role= "page" id= "Home-page" > </ div> <div data-role= "page" id= "Copyright-page" > </div>
In fact, page configuration is very simple, but we look at the following source:
#7470 var $pages = $ (": Jqmdata (role= ' page '),: Jqmdata (role= ' dialog ')"); if (! $pages. Length) { $pages = $ ("Body"). Wrapinner ("<div data-" + $.mobile.ns + role= ' page ' ></div> "). Children (0); }
Description
1, in fact, data-role= "dialog" for the jquery Mobile system is also a page everyone looked at the previous example of the dialog, found that it is not what we generally think of a traditional floating layer
2, how the page does not define page and dialog, the system will default to add a of course, this situation is very rare
Said so much, we look at the end which 3 attributes or more important!
1, $.mobile.pagecontainer
The return is: Store the page container, in the system is actually the body
SOURCE section:
#7488行 $.mobile.pagecontainer = $pages. A (). Parent (). addclass ("Ui-mobile-viewport");
2, $.mobile.firstpage
Returns: the first page
SOURCE section:
#7488行
3, $.mobile.activepage
Returns the page or dialog that is currently visible
SOURCE section:
#3385行 $.mobile.activepage = topage;