码迷,mamicode.com
首页 > 其他好文 > 详细

页面自动适应大小&&获取页面的大小

时间:2017-06-23 23:05:07      阅读:268      评论:0      收藏:0      [点我收藏+]

标签:code   input   class   分享   client   javascrip   rip   代码   png   

直接上代码:

<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">

 

技术分享

 

页面自动适应大小&&获取页面的大小

标签:code   input   class   分享   client   javascrip   rip   代码   png   

原文地址:http://www.cnblogs.com/mr-wuxiansheng/p/7071770.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!