Height content problem in mobile page

UI Components for JSF
Post Reply
cristhiancamilo511
Posts: 2
Joined: 01 Dec 2014, 18:28

10 Dec 2014, 22:47

In some cases, when we are developing mobile pages you maybe find that the content height of the main div is not full sized on the screen.

It is a jquery issue (if I can called like that) that is present in primefaces mobile. So, in order to resolve this you have to reset the content height by writing some javascript or jquery code:

$(document).ready(function(){
$(".ui-content").height(getRealContentHeight());
});
function getRealContentHeight(){
var header = $.mobile.activePage.find("div[data-role='header']:visible");
var footer = $.mobile.activePage.find("div[data-role='footer']:visible");
var content = $.mobile.activePage.find("div[role='main']:visible:visible");
var viewport_height = $(window).height();
var content_height = viewport_height - header.outerHeight() - footer.outerHeight();
if((content.outerHeight() - header.outerHeight() - footer.outerHeight()) <= viewport_height) {
content_height -= (content.outerHeight() - content.height());
}
return content_height;
}


This code gets the footer, header and content heights and resize the main div to fill the page.
Hope it helps to someone and sorry for my poor english. I'm not native and try to improving it every day :)

kukeltje
Expert Member
Posts: 9605
Joined: 17 Jun 2010, 13:34
Location: Netherlands

11 Dec 2014, 11:49

Thanks, compared to some others, your English is fine.

I created something like this to, but much simpler... Mine lead to some jumping ui things e.g. when loading a new full page or have a multi page transition... Does yours to?

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 52 guests