-
Notifications
You must be signed in to change notification settings - Fork 2.4k
resetActivePageHeight() isn't called on pageshow #7386
Comments
I found that there are no problems on http://view.jquerymobile.com/master/demos/pages-multi-page/ standard example. In my case I don't use |
A test page to reproduce the problem: Here |
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". |
What do you think also about introducing new event: This even may be used to expand a widget height (for example textarea,ui-textinput) to fill all not used space in This idea even better then |
@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 $(window.document).on("pageinit", function (event) {
var $page = $(event.target),
$fullHeight = $page.find(".ui-fullheight");
if (!$fullHeight.length) {
// Improve performance by skipping pages from processing
// which initially don't have fullheight widgets
return;
}
$page.on("pageresize updatelayout", function () {
$fullHeight
// Only the first visible fullheight widget may be expanded
.filter(":visible:first")
.each(function () {
var $element = $(this),
initHeight = $element.jqmData("init-height");
if (!initHeight) {
// Save initial height
initHeight = $element.height();
$element.jqmData("init-height", initHeight);
}
$element
// Reset height to calculate correct extra space in content
.height(0)
.height(
Math.max(
initHeight,
// Calculate extra space
$page.outerHeight() -
$page.find(".ui-header").outerHeight() -
$page.find(".ui-content").outerHeight()
)
);
});
});
}); |
Related to commit:
65ad2f9
loadDeferred
is never resolved on Chrome (34.0.1847.131 m) on Windows 7 SP1 x64:so
resetActivePageHeight
is never called onpageshow
:The text was updated successfully, but these errors were encountered: