码迷,mamicode.com
首页 > 移动开发 > 详细

移动端计算页面尺寸

时间:2015-09-10 17:20:06      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:

function setGameCanvasSize(gameCanvasId) {
    
    var scale =  document.documentElement.clientHeight/gameCanvasId.offsetHeight;
    
    gameCanvasId.style.marginLeft = -(gameCanvas.clientWidth)/2 + ‘px‘;
    gameCanvasId.style.MozTransform = ‘scale(‘ + scale + ‘)‘;
    gameCanvasId.style.MsTransform = ‘scale(‘ + scale + ‘)‘;
    gameCanvasId.style.OTransform = ‘scale(‘ + scale + ‘)‘;
    gameCanvasId.style.WebkitTransform = ‘scale(‘ + scale + ‘)‘;
    gameCanvasId.style.transform = ‘scale(‘ + scale + ‘)‘;
}

 

移动端计算页面尺寸

标签:

原文地址:http://www.cnblogs.com/lilixing/p/4798461.html

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