views:

61

answers:

1

and set the 'height' 1/2 of full screen.

this is my code:

<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml" manifest="/m?manifest=1">
 <head> 
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
  <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no, width=device-width">

 </head>
<body >
<div></div>
<style type="text/css">
div{
 background:red;
}
</style>
<script src="jquery-1.4.2.js" type="text/javascript"></script>
<script type="text/javascript">


</script>
</body>
</html>

thanks

A: 

I would do it with a combination of css and javascript (using jquery).

for the javascript

        updateOrientation : function() {
            var orientation = window.orientation;

            switch (orientation) {

                // If we're horizontal
                case 90:
                case -90:

                // Set orient to landscape
                $(body).addClass("landscape");
                break;  

                // If we're vertical
                default:

                // Set orient to portrait
                $(body).addClass("portrait");
                break;
            }

        }

for the css:

body{
    height: 240px;
}

/* Reposition on orientation change */
body.landscape{
    height: 160px;
}

This is just a basic outline, adjust it as you see fit

tzenes
but ,div is not full screen(in width)
zjm1126
how to catch the event of orientation event(when change).thanks
zjm1126
window.onorientationchange = updateOrientation
tzenes
what do you mean by not full screen in width?
tzenes