diff --git a/Makefile b/Makefile index a8731700..ba26e9ed 100644 --- a/Makefile +++ b/Makefile @@ -147,7 +147,7 @@ nightly: pull zip @@mkdir -p ${VER} # Copy in the base stuff for the demos - @@cp -r index.html themes experiments docs ${VER}/ + @@cp -r index.html themes experiments docs tools ${VER}/ # First change all the paths from super deep to the same level for JS files @@find ${VER} -type f -name '*.html' -exec sed -i 's|src="../../../js|src="js|g' {} \; @@ -184,7 +184,7 @@ deploy: zip # Deploy Demos to the jQueryMobile.com site @@mkdir -p ${VER} - @@cp -r index.html themes experiments docs ${VER}/ + @@cp -r index.html themes experiments docs tools ${VER}/ @@find ${VER} -type f -name '*.html' -exec sed -i "" -e 's|src="../../../js|src="js|g' {} \; @@find ${VER} -type f -name '*.html' -exec sed -i "" -e 's|src="../../js|src="js|g' {} \; diff --git a/README.md b/README.md index 0d945a59..ef3b6bc4 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,9 @@ A full, complete version and a minified, complete version of the jQuery Mobile J Submitting bugs =================================== -If you think you've found a bug, please visit the Issue tracker (https://github.com/jquery/jquery-mobile/issues) and create an issue explaining the problem and expected result. Be sure to include any relevant information for reproducing the issue, such as the browser/device (with version #), and the version of the jQuery Mobile code you're running. It also helps a lot to make sure that the bug still exists on jquerymobile.com/test/, as it's possible we may have fixed it already! It is also best to include code to reproduce the bug. +If you think you've found a bug, please visit the Issue tracker (https://github.com/jquery/jquery-mobile/issues) and create an issue explaining the problem and expected result. Be sure to include any relevant information for reproducing the issue, such as the browser/device (with version #), and the version of the jQuery Mobile code you're running. It also helps a lot to make sure that the bug still exists on http://jquerymobile.com/test/, as it's possible we may have fixed it already! + +It is also best to include code to reproduce the bug. To do that please use [jsbin](http://jsbin.com) or [jsfiddle](http://jsfiddle.net) and include a link to it in the ticket. Submitting patches diff --git a/docs/_assets/css/jqm-docs.css b/docs/_assets/css/jqm-docs.css index 208b192a..c3ee2c25 100644 --- a/docs/_assets/css/jqm-docs.css +++ b/docs/_assets/css/jqm-docs.css @@ -5,12 +5,11 @@ cobblers, shoes, */ body { background: #dddddd; } - .ui-mobile .type-home .ui-content { margin: 0; background: #e5e5e5 url(../images/jqm-sitebg.png) top center repeat-x; } .ui-mobile #jqm-homeheader { padding: 40px 10px 0; text-align: center; margin: 0 auto; } .ui-mobile #jqm-homeheader h1 { margin: 0 0 ; } .ui-mobile #jqm-homeheader p { margin: .3em 0 0; line-height: 1.3; font-size: .9em; font-weight: bold; color: #666; } -.ui-mobile #jqm-version { text-indent: -99999px; background: url(../images/version.png) top right no-repeat; width: 119px; height: 122px; overflow: hidden; position: absolute; z-index: 50; top: 0; right: 0; } +.ui-mobile #jqm-version { text-indent: -99999px; background: url(../images/version.png) top right no-repeat; width: 119px; height: 122px; overflow: hidden; position: absolute; z-index: 50; top: -11px; right: 0; } .ui-mobile .jqm-themeswitcher { margin: 10px 25px 10px 10px; } h2 { margin:1.2em 0 .4em 0; } diff --git a/docs/api/events.html b/docs/api/events.html index 24f38b99..53370be1 100755 --- a/docs/api/events.html +++ b/docs/api/events.html @@ -64,7 +64,12 @@

Orientation change event

orientationchange
-
Triggers when a device orientation changes (by turning it vertically or horizontally). When bound to this event, your callback function can leverage a second argument, which contains an orientation property equal to either "portrait" or "landscape". These values are also added as classes to the HTML element, allowing you to leverage them in your CSS selectors. Note that we currently bind to the resize event when orientationChange is not natively supported.
+
Triggers when a device orientation changes (by turning it vertically or horizontally). When bound to this event, your callback function can leverage a second argument, which contains an orientation property equal to either "portrait" or "landscape". These values are also added as classes to the HTML element, allowing you to leverage them in your CSS selectors. Note that we currently bind to the resize event when orientationChange is not natively supported, or when $.mobile.orientationChangeEnabled is set to false.
+
+

orientationchange timing

+ + The timing of the orientationchange with relation to the change of the client height and width is different between browsers, though the current implementation will give you the correct value for event.orientation derived from window.orientation. This means that if your bindings are dependent on the height and width values you may want to disable orientationchange all together with $.mobile.orientationChangeEnabled = false to let the fallback resize code trigger your bindings. +

Scroll events

@@ -226,7 +231,7 @@ $( document ).bind( "pageloadfailed", function( event, data ){ -
  • options (object) +
  • options (object) diff --git a/docs/api/globalconfig.html b/docs/api/globalconfig.html index 6dba4c7e..498e9d86 100755 --- a/docs/api/globalconfig.html +++ b/docs/api/globalconfig.html @@ -68,6 +68,7 @@ $(document).bind("mobileinit", function(){ +

    To quickly preview these global configuration options in action, check out the config test pages.

    Configurable options

    The following defaults are configurable via the $.mobile object:

    @@ -98,15 +99,17 @@ $(document).bind("mobileinit", function(){
    ajaxEnabled boolean, default: true
    jQuery Mobile will automatically handle link clicks and form submissions through Ajax, when possible. If false, url hash listening will be disabled as well, and urls will load as regular http requests.
    -
    hashListeningEnabled boolean, default: true
    jQuery Mobile will automatically listen and handle changes to the location.hash. Disabling this will prevent jQuery Mobile from handling hash changes, which allows you to handle them yourself, or simply to use simple deep-links within a document that scroll to a particular ID.
    + +
    pushStateEnabled boolean, default: true
    +
    Enhancement to use history.replaceState in supported browsers, to convert the hash-based Ajax URL into the full document path. Note that we recommend disabling this feature if Ajax is disabled or if extensive use of external links are used.
    defaultPageTransition string, default: 'slide'
    Set the default transition for page changes that use Ajax. Set to 'none' for no transitions by default.
    touchOverflowEnabled boolean, default: false
    -
    Enable pages to have self-contained native scrolling and fixed toolbars in devices that support the overflow-scrolling: touch; property.
    +
    Enable smoother page transitions and true fixed toolbars in devices that support both the overflow: and overflow-scrolling: touch; CSS properties.
    defaultDialogTransition string, default: 'pop'
    Set the default transition for dialog changes that use Ajax. Set to 'none' for no transitions by default.
    diff --git a/docs/api/themes.html b/docs/api/themes.html index adba44ba..c93c1078 100755 --- a/docs/api/themes.html +++ b/docs/api/themes.html @@ -51,11 +51,11 @@

    The default theme contains the following five Bar styles:

    -
    Bar A
    -
    Bar B
    -
    Bar C
    -
    Bar D
    -
    Bar E
    +
    Bar A - Link
    +
    Bar B - Link
    +
    Bar C - Link
    +
    Bar D - Link
    +
    Bar E - Link

    By default, the framework assigns the "a" swatch to all headers and footers, because these are typically given high visual priority in an application. To set the color of a bar to a different swatch color, simply add the data-theme attribute to your header or footer and specify an alternate swatch letter ('b' or 'd', for example) and the specified theme swatch color will be applied. Learn more about toolbar theming.

    @@ -66,11 +66,11 @@

    The default theme also includes color swatch values for use in content blocks, designed to coordinate with the header color swatches in the theme.

    -
    Block A
    -
    Block B
    -
    Block C
    -
    Block D
    -
    Block E
    +
    Block A - Link
    +
    Block B - Link
    +
    Block C - Link
    +
    Block D - Link
    +
    Block E - Link
    diff --git a/docs/buttons/buttons-types.html b/docs/buttons/buttons-types.html index 0e5e8ebf..6da660f0 100755 --- a/docs/buttons/buttons-types.html +++ b/docs/buttons/buttons-types.html @@ -54,16 +54,16 @@

    Input type="button" based button:

    - +

    Input type="submit" based button:

    - +

    Input type="reset" based button:

    - +

    Input type="image" based button:

    - + diff --git a/docs/config/dialogTransition.html b/docs/config/dialogTransition.html new file mode 100644 index 00000000..d8a42b8f --- /dev/null +++ b/docs/config/dialogTransition.html @@ -0,0 +1,40 @@ + + + + + + jQuery Mobile Docs - Configuration + + + + + + + + + + + +
    + +
    +

    Config applied

    + Home +
    + +
    + +

    defaultDialogTransition is now "flip"

    +

    To test, hit the button below and browse the docs. Note that if a link causes a refresh, this setting will be lost and the default settings will be seen.

    + Browse docs + Or open a basic dialog + +
    +
    + + + diff --git a/docs/config/index.html b/docs/config/index.html new file mode 100644 index 00000000..8ed837c9 --- /dev/null +++ b/docs/config/index.html @@ -0,0 +1,84 @@ + + + + + + jQuery Mobile Docs - Configuration + + + + + + + + + +
    + +
    +

    Pages

    + Home +
    + +
    +

    Global config tests

    +

    The following links will cause a full page refresh so that the global options configuration can take effect. Each link below will tweak a different option for quick testing.

    + + + + + +
    +
    + + + diff --git a/docs/config/jq17b1.html b/docs/config/jq17b1.html new file mode 100644 index 00000000..4d254e52 --- /dev/null +++ b/docs/config/jq17b1.html @@ -0,0 +1,34 @@ + + + + + + jQuery Mobile Docs - Configuration + + + + + + + + + +
    + +
    +

    jQuery version

    + Home +
    + +
    + +

    jQuery core version 1.7 Beta 1

    +

    To test, hit the button below and browse the docs. Note that if a link causes a refresh, this setting will be lost and the default settings will be seen.

    + Browse docs + + +
    +
    + + + diff --git a/docs/config/loadingMessage.html b/docs/config/loadingMessage.html new file mode 100644 index 00000000..f5c168c3 --- /dev/null +++ b/docs/config/loadingMessage.html @@ -0,0 +1,40 @@ + + + + + + jQuery Mobile Docs - Configuration + + + + + + + + + + + +
    + +
    +

    Config applied

    + Home +
    + +
    + +

    loadingMessage is now disabled

    +

    To test, hit the button below and browse the docs. Note that if a link causes a refresh, this setting will be lost and the default settings will be seen.

    + Browse docs + + +
    +
    + + + diff --git a/docs/config/minScrollBack.html b/docs/config/minScrollBack.html new file mode 100644 index 00000000..4ae66264 --- /dev/null +++ b/docs/config/minScrollBack.html @@ -0,0 +1,40 @@ + + + + + + jQuery Mobile Docs - Configuration + + + + + + + + + + + +
    + +
    +

    Config applied

    + Home +
    + +
    + +

    minScrollBack is now set to 999 (disabled)

    +

    To test, hit the button below and browse the docs. Note that if a link causes a refresh, this setting will be lost and the default settings will be seen.

    + Browse docs + + +
    +
    + + + diff --git a/docs/config/pageLoadErrorMessage.html b/docs/config/pageLoadErrorMessage.html new file mode 100644 index 00000000..e08c0f24 --- /dev/null +++ b/docs/config/pageLoadErrorMessage.html @@ -0,0 +1,41 @@ + + + + + + jQuery Mobile Docs - Configuration + + + + + + + + + + + +
    + +
    +

    Config applied

    + Home +
    + +
    + +

    pageLoadErrorMessage is now "Yikes, we broke the internet!"

    +

    To test, hit the button below and browse the docs. Note that if a link causes a refresh, this setting will be lost and the default settings will be seen.

    + Browse docs + Or try this broken link + + +
    +
    + + + diff --git a/docs/config/pageTransition.html b/docs/config/pageTransition.html new file mode 100644 index 00000000..64d16b88 --- /dev/null +++ b/docs/config/pageTransition.html @@ -0,0 +1,40 @@ + + + + + + jQuery Mobile Docs - Configuration + + + + + + + + + + + + +
    + +
    +

    Config applied

    + Home +
    + +
    + +

    defaultPageTransition is now "fade"

    +

    To test, hit the button below and browse the docs. Note that if a link causes a refresh, this setting will be lost and the default settings will be seen.

    + Browse docs + +
    +
    + + + diff --git a/docs/config/pushState.html b/docs/config/pushState.html new file mode 100644 index 00000000..fed9ef37 --- /dev/null +++ b/docs/config/pushState.html @@ -0,0 +1,40 @@ + + + + + + jQuery Mobile Docs - Configuration + + + + + + + + + + + +
    + +
    +

    Config applied

    + Home +
    + +
    + +

    pushStateEnabled is now disabled

    +

    To test, hit the button below and browse the docs. Note that if a link causes a refresh, this setting will be lost and the default settings will be seen.

    + Browse docs + + +
    +
    + + + diff --git a/docs/config/touchOverflow.html b/docs/config/touchOverflow.html new file mode 100644 index 00000000..9cb57410 --- /dev/null +++ b/docs/config/touchOverflow.html @@ -0,0 +1,40 @@ + + + + + + jQuery Mobile Docs - Configuration + + + + + + + + + + + +
    + +
    +

    Config applied

    + Home +
    + +
    + +

    touchOverflowEnabled is now active

    +

    To test, hit the button below and browse the docs. Note that if a link causes a refresh, this setting will be lost and the default settings will be seen.

    + Browse docs + + +
    +
    + + + diff --git a/docs/forms/checkboxes/index.html b/docs/forms/checkboxes/index.html index 64e78c95..de600ddd 100755 --- a/docs/forms/checkboxes/index.html +++ b/docs/forms/checkboxes/index.html @@ -89,7 +89,7 @@

    Checkboxes can also be used for grouped button sets where more than one button can be selected at once, such as the bold, italic and underline button group seen in word processors. To make a horizontal button set, add the data-type="horizontal" to the fieldset.

    -<fieldset data-role="controlgroup" data-type="horizontal" data-role="fieldcontain"> +<fieldset data-role="controlgroup" data-type="horizontal">

    The framework will float the labels so they sit side-by-side on a line, hide the checkbox icons and only round the left and right edges of the group.

    diff --git a/docs/pages/page-dynamic.html b/docs/pages/page-dynamic.html index d1f39746..4dd23238 100644 --- a/docs/pages/page-dynamic.html +++ b/docs/pages/page-dynamic.html @@ -30,13 +30,13 @@
  • pagebeforechange
  • pagechange
  • pagechangefailed diff --git a/docs/pages/page-links.html b/docs/pages/page-links.html index 66e86a86..27dd419a 100755 --- a/docs/pages/page-links.html +++ b/docs/pages/page-links.html @@ -39,7 +39,9 @@

    Linking without Ajax

    -

    Links that point to other domains or that have rel="external", data-ajax="false" or target attributes will not be loaded with Ajax. Instead, these links and will cause a full page refresh with no animated transition. Both attributes have the same effect, but different semanic meaning. rel="external" should be used when linking to another site or domain, while data-ajax="false" is useful for simply opting a page within your domain from being loaded via Ajax. Because of security restrictions, the framework always opts links to external domains out of the Ajax behavior.

    +

    Links that point to other domains or that have rel="external", data-ajax="false" or target attributes will not be loaded with Ajax. Instead, these links and will cause a full page refresh with no animated transition. Both attributes have the same effect, but different semantic meaning: rel="external" should be used when linking to another site or domain, while data-ajax="false" is useful for simply opting a page within your domain from being loaded via Ajax. Because of security restrictions, the framework always opts links to external domains out of the Ajax behavior.

    + +

    Note: When building a jQuery Mobile application where the Ajax navigation system is disabled globally or frequently disabled on individual links, we recommend disabling the $.mobile.pushStateEnabled global configuration option to avoid inconsistent navigation behavior in some browsers.

    diff --git a/docs/pages/page-navmodel.html b/docs/pages/page-navmodel.html index b952c252..0919e965 100644 --- a/docs/pages/page-navmodel.html +++ b/docs/pages/page-navmodel.html @@ -43,11 +43,16 @@

    Once the referenced page is present in the DOM, the $.mobile.changePage() function applies a transition between the current active page and the new page. Page transitions happen through adding and removing classes that apply CSS animations. For example, in a slide-left transition, the exiting page is given the classes "slideleft" and "out", and the entering page is given the classes "slideleft" and "in", as well as a class of "ui-page-active" to mark it as the new "active" page being viewed. When the animation is complete, the "in" and "out" classes are removed, and the exited page loses its "ui-page-active" class.

    -

    replaceState plugin

    +

    pushState plugin

    -

    For those browsers that support history.pushState and history.replaceState an additional optional plugin is provided that will convert the hash change urls mentioned in the previous section into the hashless equivelant. It's important to note that it does indeed convert the hash urls by using history.replaceState as the history.pushState does not produce the desired result in some mobile browsers.

    +

    There is an optional feature is converts the longer, hash-based URLs mentioned in the previous section into the full document path which is cleaner and makes the Ajax tracking transparent in the URL structure. This is built as an enhancement on top of the hash-based URL system for Ajax links. Note that despite the name, this feature technically converts hash-based urls by using history.replaceState (not history.pushState) in the current release because this works more reliably across our target platforms. For browsers that do not support history.replaceState, or if this feature is disabled, hash-based URLs will be used instead.

    -

    Since the plugin initializes when the DOM is fully loaded you can enable and disable it manually by setting $.mobile.pushStateEnabled anytime before.

    +

    Since the plugin initializes when the DOM is fully loaded you can enable and disable it manually by setting $.mobile.pushStateEnabled global configuration option to false anytime before document ready.

    + +
    +

    Important: rel="external" and $.mobile.ajaxEnabled=false

    +

    Slightly different implementations of the replaceState API in various browsers can cause odd behavior in specific scenarios. For example, some browser implementations (including desktop browsers) implement the popstate event differently when linking externally and moving back to a page onto which state has already been pushed/replaced. When building a jQuery Mobile application where the ajax navigation is being explicitly disabled, either though the frequent use of rel="external" on links or by disabling Ajax navigation completely via the $.mobile.ajaxEnabled=false, we recommend disabling the pushState feature to fall back to the hash based navigation for more consistent behavior.

    +

    changePage

    @@ -57,7 +62,7 @@

    Base element

    -

    Another key ingredient to jQuery Mobile's page navigation model is the base element, which is injected into the head and modified on every page change to ensure that any assets (css,images,js,etc) referenced on that page will be requested from a proper path. In browsers that don't support dynamic updates to the base element (such as Firefox 3.6), jQuery Mobile loops through all of the referenced assets on the page and prefixes their href and src attributes with the base path.

    +

    Another key ingredient to jQuery Mobile's page navigation model is the base element, which is injected into the head and modified on every page change to ensure that any assets (images, CSS, JS, etc.) referenced on that page will be requested from a proper path. In browsers that don't support dynamic updates to the base element (such as Firefox 3.6), jQuery Mobile loops through all of the referenced assets on the page and prefixes their href and src attributes with the base path.

    Developer explanation of base url management:

    @@ -67,11 +72,11 @@

    TODO: update description of internal base and urlHistory objects

    Data-url storage

    - -

    The nav model maintains a data-url attribute on all data-role=”page” elements. This data-url attribute is used to track the origin of the page element. Pages embedded within the main application document all have their data-url parameter set to the ID of the @data-role="page" element. The only exception to this is the first-page in the document. The first-page is special because it can be addressed by its @id if it has one, or by the document or base URL (with no hash fragment).

    + +

    The nav model maintains a data-url attribute on all data-role="page" elements. This data-url attribute is used to track the origin of the page element. Pages embedded within the main application document all have their data-url parameter set to the ID of the @data-role="page" element. The only exception to this is the first-page in the document. The first-page is special because it can be addressed by its @id if it has one, or by the document or base URL (with no hash fragment).

    Pages that are external to the application document get pulled in dynamically via ajax, their data-url is set to the site relative path to the external page. If you are running in an environment where loading an external page from a different domain is allowed, then the data-url is set to the absolute URL.

    - +

    Auto-generated pages and sub-hash urls

    Some plugins may choose to dynamically break a page's content into separate navigable pages, which can then be reached via deep links. One example of this would be the Listview plugin, which will break a nested UL (or OL) into separate pages, which are each given a data-url attribute so they can be linked to like any normal "page" in jQuery Mobile. However, in order to link to these pages, the page that generates them must first be requested from the server. To make this work, pages that are auto-generated by plugins use the following special data-url structure: @@ -106,6 +111,7 @@

  • Any unique assets referenced by pages in a jQuery Mobile-driven site should be placed inside the "page" element (the element with a data-role attribute of "page"). For example, links to styles and scripts that are specific to a particular page can be referenced inside that div. However, a better approach is to use jQuery Mobile's page events to trigger specific scripting when certain pages load. Note: you can return a page from the server with a data-url already specified in the markup, and jQuery Mobile will use that for the hash update. This allows you to ensure directory paths resolve with a trailing slash and will therefore be used in the base url path for future requests.

  • Conversely, any non-unique assets (those used site-wide) should be referenced in the <head> section of an HTML document, or at the very least, outside of the "page" element, to prevent running scripts more than once.

  • The "ui-page" key name used in sub-hash url references can be set to any value you'd like, so as to blend into your URL structure. This value is stored in jQuery.mobile.subPageUrlKey.

  • +
  • When traveling back to a previously loaded jQuery Mobile document from an external or internal document with the push state plugin enabled, some browsers load and trigger the popstate event on the wrong document or for the wrong reasons (two edge cases recorded so far). If you are regularly linking to external documents and find the application behaving eratically try disabling pushstate support.

  • diff --git a/docs/pages/page-scripting.html b/docs/pages/page-scripting.html index d5586a3e..49981682 100644 --- a/docs/pages/page-scripting.html +++ b/docs/pages/page-scripting.html @@ -22,27 +22,39 @@
    -

    Since jQuery Mobile uses an Ajax-powered navigation system, there are a few helpful things to know when writing scripts that interact with the page and navigation model. You can explore the mobile API in more detail by reading up on global configuration options, events, and methods or dig into the technical details of the Ajax navigation model.

    +

    Since jQuery Mobile uses an Ajax-powered navigation system, there are a few helpful things to know when writing scripts that manipulate your content. You can explore the mobile API in more detail by reading up on global configuration options, events, and methods or dig into the technical details of the Ajax navigation model.

    -

    Scripts & styles in the head

    +

    Scripts & styles in the head

    -

    When you click a link in jQuery Mobile, the Ajax navigation system uses the link's href to formulate an Ajax request. Although the full page is loaded with Ajax, the framework only pulls in the contents of the page, and ignores anything in the head except for title tag contents.

    -

    This means that any scripts or styles in the head of the page won't have any effect when the page is loaded via Ajax. The same page will work as expected if you were to load a page directly but both scenarios need to be considered. The reason that the head is ignored for Ajax page content: it's just too complex. The framework would need to compare and reconcile the contents of multiple page head elements as they are loaded into the DOM so we leave this task to the developer.

    +

    When the user clicks a link in a jQuery Mobile-driven site, the default behavior of the navigation system is to use that link's href to formulate an Ajax request (instead of allowing the browser's default link behavior of requesting that href with full page load). When that Ajax request goes out, the framework will receive its entire text content, but it will only inject the contents of the response's body element (or more specifically the data-role="page" element, if it's provided), meaning nothing in the head of the page will be used (with the exception of the page title, which is fetched specifically).

    -

    The simplest approach is to add the same set of stylesheets and scripts into all your pages. If you need to load in specific scripts or styles for a particular page, bind to the pagecreate event (details below) to run the necessary code when a specific page ID is created. Following this approach will ensure that the code executes if the page is loaded directly or is pulled in and shown via Ajax.

    +

    This means that any scripts and styles referenced the head of a page won't have any effect when a page is loaded via Ajax, but they will execute if the page is requested normally via HTTP. When scripting jQuery Mobile sites, both scenarios need to be considered. The reason that the head of a page is ignored when requested via Ajax is that the potential of re-executing the same JavaScript is very high (it's common to reference the same scripts in every page of a site). Due to the complexity of attempting to work around that issue, we leave the task of executing page-specific scripts to the developer, and assume head scripts are only expected to execute once per browsing session.

    + +

    The simplest approach when building a jQuery Mobile site is to reference the same set of stylesheets and scripts in the head of every page. If you need to load in specific scripts or styles for a particular page, we recommend binding logic to the pagecreate event (details below) to run necessary code when a specific page is created (which can be determined by its id attribute, or a number of other ways). Following this approach will ensure that the code executes if the page is loaded directly or is pulled in and shown via Ajax.

    + +

    Another approach for page-specific scripting would be to include scripts at the end of the body element. If you include your custom scripting this way, be aware that these scripts will execute when that page is loaded via Ajax or regular HTTP, so if these scripts are the same on every page, you'll likely run into problems. If you're including scripts this way, we'd recommend enclosing your page content in a data-role="page" element, and placing scripts that are referenced on every page outside of that element. Scripts that are unique to that page can be placed in that element, to ensure that they execute when the page is fetched via Ajax.

    pagecreate = DOM ready

    -

    The first thing you learn in jQuery is to call code inside the $(document).ready() function so everything will execute as soon as the DOM is loaded. However, in jQuery Mobile, Ajax is used to load the contents of each page into the DOM as you navigate, and the DOM ready handler only executes for the first page. To execute code whenever a new page is loaded and created by the Ajax navigation system, you must bind to the pagecreate event.

    -

    The pagecreate event is triggered on the page being initialized, right after initialization occurs. We recommend binding to this event instead of DOM ready() because this will work regardless of whether the page is loaded directly or if the content is pulled into another page as part of the Ajax navigation system.

    +

    One of the first things people learn in jQuery is to use the $(document).ready() function for executing DOM-specific code as soon as the DOM is ready (which often occurs long before the onload event). However, in jQuery Mobile site and apps, pages are requested and injected into the same DOM as the user navigates, so the DOM ready event is not as useful, as it only executes for the first page. To execute code whenever a new page is loaded and created in jQuery Mobile, you can bind to the pagecreate event.

    + +

    The pagecreate event is triggered on a page when it is initialized, right after initialization occurs. Most of jQuery Mobile's official widgets auto-initialize themselves based on this event, and you can set up your code to do the same.

    
    -$('#aboutPage').live('pagecreate',function(event){
    -  alert('This page was just enhanced by jQuery Mobile!');
    +$( document ).delegate( "pagecreate", "#aboutPage", function() {
    +  alert('A page with an ID of "aboutPage" was just created by jQuery Mobile!');
    +});
    +
    + +

    If you'd like to manipulate a page's contents before the pagecreate event fires and widgets are auto-initialized, you can instead bind to the pagebeforecreate event:

    + +
    
    +$( document ).delegate( "pagebeforecreate", "#aboutPage", function() {
    +  alert('A page with an ID of "aboutPage" is about to be created by jQuery Mobile!');
     });
     

    Changing pages

    -

    If you need to change the current page with JavaScript, use the changePage method. There are a lot of methods and properties that you can set when changing pages, but here are two simple examples:

    +

    If you want to change the current active page with JavaScript, you can use the changePage method. There are a lot of methods and properties that you can set when changing pages, but here are two simple examples:

    
     //transition to the "about us" page with a slideup transition 			
     $.mobile.changePage( "about/us.html", { transition: "slideup"} );	
    diff --git a/docs/toolbars/docs-navbar.html b/docs/toolbars/docs-navbar.html
    index ad5720c2..362b656f 100755
    --- a/docs/toolbars/docs-navbar.html
    +++ b/docs/toolbars/docs-navbar.html
    @@ -24,35 +24,32 @@
     		

    Simple navbar

    -

    jQuery Mobile has a very basic navbar widget that is useful for providing up to 5 buttons with optional icons in a bar , typically within a header or footer.

    - +

    jQuery Mobile has a very basic navbar widget that is useful for providing up to 5 buttons with optional icons in a bar, typically within a header or footer. There is also a persistent nav bar variation that works more like a tab bar that stays fixed as you navigate across pages.

    A navbar is coded as an unordered list of links wrapped in a container element that has the data-role="navbar" attribute. To set one of links to the active (selected) state, add class="ui-btn-active" to the anchor. In this example, we have a two-button navbar in the footer with the "One" item set to active:

    
    -<div data-role="footer">
    -	<div data-role="navbar">
    -		<ul>
    -			<li><a href="a.html" class="ui-btn-active">One</a></li>
    -			<li><a href="b.html">Two</a></li>
    -		</ul>
    -	</div><!-- /navbar -->
    -</div><!-- /footer -->
    +<div data-role="navbar">
    +	<ul>
    +		<li><a href="a.html" class="ui-btn-active">One</a></li>
    +		<li><a href="b.html">Two</a></li>
    +	</ul>
    +</div><!-- /navbar -->
     

    The navbar items are set to divide the space evenly so in this case, each button is 1/2 the width of the browser window:

    -
    + -
    +

    Adding a third item will automatically make each button 1/3 the width of the browser window:

    -
    +
    -
    +

    Adding a fourth more item will automatically make each button 1/4 the width of the browser window:

    -
    +
    -
    +

    The navbar maxes out with 5 items, each 1/5 the width of the browser window:

    -
    +
    -
    +

    If more than 5 items are added, the navbar will simply wrap to multiple lines:

    -
    • One
    • @@ -106,17 +102,14 @@
    • Ten
    -

    As a fallback, navbars with 1 item will simply render as 100%.

    -
    -

    Navbars in headers

    @@ -135,9 +128,33 @@
    +

    Navbars in footers

    + +

    If you want to add a navbar to the bottom of the page so it acts more like a tab bar, simply wrap the navbar in a container with a data-role="footer"

    +
    
    +<div data-role="footer">		
    +	<div data-role="navbar">
    +		<ul>
    +			<li><a href="#">One</a></li>
    +			<li><a href="#">Two</a></li>
    +			<li><a href="#">Three</a></li>
    +		</ul>
    +	</div><!-- /navbar -->
    +</div><!-- /footer -->
    +
    +
    +
    + +
    +
    +

    Icons in navbars

    -

    Icons can be added to navbar items by adding the data-icon attribute specifying a standard mobile icon to each anchor.

    +

    Icons can be added to navbar items by adding the data-icon attribute specifying a standard mobile icon to each anchor. By default icons are added above the text (data-iconpos="top"). The following examples add icons to a navbar in a footer.

    @@ -149,14 +166,41 @@
    -

    Icons can be stacked above the labels by adding the data-iconpos="top" attribute to each anchor.

    +

    The icon position is set on the navbar container instead of for individual links within for visual consistency. For example, to place the icons below the labels, add the data-iconpos="bottom" attribute to navbar container.

    +
    
    +<div data-role="navbar" data-iconpos="bottom">
    +
    +

    This will result in a bottom icon alignment:

    +
    +
    + +
    +
    + +

    The icon position can be set to data-iconpos="left":

    -
    +
    +
    +
    + +

    Or the icon position can be set to data-iconpos="right":

    + +
    +
    +
    @@ -168,7 +212,7 @@