Skip to content
This repository has been archived by the owner on Oct 8, 2021. It is now read-only.

Navigation: enable adding custom code to loadPage #4884

Closed
wants to merge 1 commit into from

Conversation

tqc
Copy link

@tqc tqc commented Aug 22, 2012

Add a new option $.mobile.loadPage.defaults.completeLoad which allows the user to define when a page has been fully loaded.

By default the existing functionality is unchanged - a page is considered loaded when the html has been added to the dom.

If pages include large images which are not preloaded or other asynchronous components, the page may be displayed before it is fully rendered.

Adding the below code (and the waitForImages plugin) to the app keeps the loading message visible for longer and does not start the transition until the page is actually ready to be displayed.

$.mobile.loadPage.defaults.completeLoad = function(page, callback ) {
    $(page).waitForImages(function() {
       callback();
    });
};

…can delay the transition when additional elements such as background images need to be loaded before displaying the page
@johnbender
Copy link
Contributor

@tqc

We're pretty much frozen on the navigation code at this point. There's going to be a gigantic cleanup coming soon so we'll likely wait until after that to consider something like this. Hopefully it'll also be easier to set up.

Thanks for the PR, the idea is entirely sound.

@johnbender johnbender closed this Apr 1, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants