屏幕适配

<script type="text/JavaScript">

var size = 1.0;
function showheight() {
alert(document.body.clientHeight);
}
function zoomout() {
size = size + 0.1;
set();
}


function zoomin() {
size = size - 0.1;
set();
}


function set() {
//document.body.style.cssText = document.body.style.cssText + '; -webkit-transform: scale(' + size + ');-webkit-transform-origin: 0 0;';
//document.body.style.cssText = document.body.style.cssText + '; -webkit-transform: scale(' + size + '); ';
//$(body).css("width","120%);
document.body.style.zoom = size;
document.body.style.cssText += '; -moz-transform: scale(' + size + ');-moz-transform-origin: 0 0; '; //
}
</script>
<input type="button" onclick="javascript:zoomin();" value="zoomin">
<input type="button" onclick="javascript:zoomout();" value="zoomout">
<input type="button" onclick="javascript:showheight();" value="showheight">

posted @ 2018-07-05 16:49  Mr_伍先生  阅读(214)  评论(0编辑  收藏  举报