I follow this post trying to get my jQM Page ui-content background image height to 100%: Link to solution provided by Omar
I got 2 problem, first is height doesn't meet 100% (short of 16px), second is the background image will stretch it's height a little longer before transition, and shrink back after transition. Anyone have any solution to fix this?
The following is my code:
$(document).on('pagebeforeshow', '#userMainPage', function () {
var screen = $.mobile.getScreenHeight();
alert("Screen height: " + screen);
var header = $(".ui-header").hasClass("ui-header-fixed") ? $(".ui-header").outerHeight() - 1 : $(".ui-header").outerHeight();
alert("Header size: " + header);
var footer = $(".ui-footer").hasClass("ui-footer-fixed") ? $(".ui-footer").outerHeight() - 1 : $(".ui-footer").outerHeight();
alert("Footer size: " + footer);
/* content div has padding of 1em = 16px (32px top+bottom). This step can be skipped by subtracting 32px from content var directly. */
var contentCurrent = $(".ui-content").outerHeight() - $(".ui-content").height();
alert("ui-content outerHeight: " + $(".ui-content").outerHeight());
alert("ui-content height: " + $(".ui-content").height());
alert("ContentCurrent: " + contentCurrent);
var content = screen - header - footer - contentCurrent;
alert("Content: " + content);
$(".ui-content").height(content);
});
I just can't get 100% height. My height is short of 16px to be Full 100% height.
Following info for better debugging:
- Screen height: 548
- header size: 44
- footer size: 34
- outerHeight: 32
- ui-content.height: 0
contentCurrent: 32
final new height: 438
Please tell me what is wrong here. Thank you in advance.