resetActivePageHeight() isn't called on pageshow #7386

DzenisevichK opened this Issue May 9, 2014 · 6 comments


None yet

2 participants


Related to commit:

loadDeferred is never resolved on Chrome (34.0.1847.131 m) on Windows 7 SP1 x64:

    $.mobile.window.load( function() {

        // Resolve and null the deferred
        loadDeferred = null;

so resetActivePageHeight is never called on pageshow:

        $.mobile.document.bind( "pageshow", function() {

            // We need to wait for window.load to make sure that styles have already been rendered,
            // otherwise heights of external toolbars will have the wrong value
            if ( loadDeferred ) {
                loadDeferred.done( $.mobile.resetActivePageHeight );
            } else {
@DzenisevichK DzenisevichK changed the title from resetActivePageHeight() doesn't called on pageshow to resetActivePageHeight() isn't called on pageshow May 9, 2014

I found that there are no problems on standard example.

In my case I don't use autoInitializePage and trigger initializePage when requirejs finish loading.


A test page to reproduce the problem:

Here $.mobile.resetActivePageHeight is never called on pageshow


OK, I think I understand the problem. If you do not initialize the page, navreadyDeferred isn't resolved, which means loadDeferred isn't attached to load until after load() has already fired. I guess it would be better to check document.readyState before attaching to load() to make sure it's not yet "complete".

@gabrielschulhof gabrielschulhof added this to the 1.4.3 milestone May 9, 2014
@gabrielschulhof gabrielschulhof self-assigned this May 9, 2014


What do you think also about introducing new event: pageresize and trigger it from resetActivePageHeight after setting min-height?

This even may be used to expand a widget height (for example textarea,ui-textinput) to fill all not used space in .ui-content...

This idea even better then autogrow option and universal (independent from widget type - may be applied to any tag).


@DzenisevichK this is not a bad idea. However, this involves a bit of re-thinking, so I have framed this as a feature request.


I use this code for implementing .ui-fullheight behaviour:

$(window.document).on("pageinit", function (event) {
    var $page = $(,
        $fullHeight = $page.find(".ui-fullheight");
    if (!$fullHeight.length) {
        // Improve performance by skipping pages from processing
        // which initially don't have fullheight widgets
    $page.on("pageresize updatelayout", function () {
            // Only the first visible fullheight widget may be expanded
            .each(function () {
                var $element = $(this),
                    initHeight = $element.jqmData("init-height");
                if (!initHeight) {
                    // Save initial height
                    initHeight = $element.height();
                    $element.jqmData("init-height", initHeight);
                    // Reset height to calculate correct extra space in content
                            // Calculate extra space
                            $page.outerHeight() -
                                $page.find(".ui-header").outerHeight() -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment