BlackBerry Layout issue.

144 views
Skip to first unread message

Suresh Kumar Narayanasamy

unread,
Mar 2, 2011, 10:58:30 PM3/2/11
to phonegap
I have a very simple html page, which just has a div. I want to set
the height of the div to the screen height in BlackBerry.
But unforutnately, even when the screen height is calculated correctly
(480px), the div takes only some portion of that (400px). Any reasons.
I have the code below.
<!DOCTYPE HTML>
<html>
<head>
<meta name="viewport" content="width=device-width, height=device-
height, initial-scale=0.8, 'maximum-scale=0.8, 'minimum-scale=0.8,
user-scalable=no" />
</head>
<script type="text/javascript" charset="utf-8" src="javascript/
phonegap.js"></script>
<script type="text/javascript" charset="utf-8">
document.addEventListener("deviceready", function() {
alert('initialized');
}, true);
document.addEventListener('DOMContentLoaded', loaded, false);
function loaded(){
var pageH = window.innerHeight;
document.getElementById('outer').style.height = pageH + 'px';
}
</script>
<body>
<div id="outer" style="background: #green;">
<h1>Welcome to PhoneGap</h1>
<h2>Edit assets/www/index.html</h2>
</div>
</body>
</html>

Justin Tyberg

unread,
Mar 3, 2011, 12:35:02 AM3/3/11
to phonegap
Try this in onload:

document.body.style.height = screen.height;

I found it on an older WebWorks post:
http://supportforums.blackberry.com/t5/Web-Development/Tips-Quirks-and-Solutions/td-p/470870

On Mar 2, 5:58 pm, Suresh Kumar Narayanasamy <n.sureshku...@gmail.com>
wrote:

Suresh Kumar Narayanasamy

unread,
Mar 3, 2011, 3:39:39 PM3/3/11
to phonegap

Worked Good. Thanks Justin....
On Mar 2, 7:35 pm, Justin Tyberg <justin.tyb...@gmail.com> wrote:
> Try this in onload:
>
> document.body.style.height = screen.height;
>
> I found it on an older WebWorks post:http://supportforums.blackberry.com/t5/Web-Development/Tips-Quirks-an...
Reply all
Reply to author
Forward
0 new messages