Navigation: enable adding custom code to loadPage #4884

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
2 participants
@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();
    });
};
Navigation: enable adding custom code to loadPage so that the caller …
…can delay the transition when additional elements such as background images need to be loaded before displaying the page
@johnbender

This comment has been minimized.

Show comment Hide comment
@johnbender

johnbender Apr 1, 2013

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.

Contributor

johnbender commented Apr 1, 2013

@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 join this conversation on GitHub. Already have an account? Sign in to comment