giovedì 3 novembre 2011

VIEWPORT

<head>
<meta name="viewport" content="width=device-width,   initial-scale=1, maximum-scale=1, user-scalable=0;" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta names="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<link rel="stylesheet" media="all and (orientation:portrait)" href="portrait.css">
<link rel="stylesheet" media="all and (orientation:landscape)" href="landscape.css">
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.1.js"></script>
</head>
<body onLoad="setTimeout(function() { window.scrollTo(0, 1) }, 100);viewport(); take_pic();" style='margin: 0px;'>
<div id='desk' style='background: white;'>
<script type="text/javascript">
<!--
function viewport()
{
var e = window
, a = 'inner';
if ( !( 'innerWidth' in window ) )
{
a = 'client';
e = document.documentElement || document.body;
}
alert(e[ a+'Width' ]+" "+e[ a+'Height' ]);
$("#desk").css({width:(e[ a+'Width' ]-2)+'px',height:(e[ a+'Height' ]-2)+'px'});
}
//-->
window.onorientationchange = function()
{
var e = window
, a = 'inner';
if ( !( 'innerWidth' in window ) )
{
a = 'client';
e = document.documentElement || document.body;
}
    var orientation = window.orientation;
    switch(orientation) {
        case 0:
$("#desk").css({width:(e[ a+'Width' ]-2)+'px',height:(e[ a+'Height' ]-2)+'px'});
//alert('1');
            //Top side up.
            break;

        case -90:
//alert('2');
$("#desk").css({height:(e[ a+'Height' ]-2)+'px',width:(e[ a+'Width' ]-2)+'px'});
            //Left side up (turned 90 degrees to the right)
            break;

        case 90:
//alert('3');
$("#desk").css({height:(e[ a+'Height' ]-2)+'px',width:(e[ a+'Width' ]-2)+'px'});
            //Right side up (turned 90 degrees to the left)
            break;
    }
}




</script>
</div>
</body>

Nessun commento:

Posta un commento