更多益智类小游戏:https://jy.tp.yuanmeng.life/js/162-0-0-0
<div id="openfl-content"></div> // Embed application, fit to best window size
var getSize = function() {
var orientation = "portrait";
var element = document.getElementById("openfl-content");
var clientWidth = element.clientWidth;
var clientHeight = element.clientHeight;
var minWidth = 320;
var minHeight = 480;
var finalWidth = minWidth;
var finalHeight = minHeight;
if (orientation == "portrait")
{
var currRatio = clientHeight / clientWidth;
var minRatio = minHeight / finalWidth;
var maxHeight = 568;
if (maxHeight == null)
maxHeight = finalHeight;
var maxRatio = maxHeight / finalWidth;
if (currRatio <= minRatio)
{
finalHeight = minHeight;
}
else if (currRatio >= maxRatio)
{
finalHeight = maxHeight;
}
else
{
finalHeight = Math.floor(finalWidth * currRatio);
}
}
else if (orientation == "landscape")
{
var currRatio = clientWidth / clientHeight;
var minRatio = minWidth / finalHeight;
var maxWidth = null;
console.log(maxWidth);
if (maxWidth == null)
maxWidth = finalWidth;
var maxRatio = maxWidth / finalHeight;
if (currRatio <= minRatio)
{
finalWidth = minWidth;
}
else if (currRatio >= maxRatio)
{
finalWidth = maxWidth;
}
else
{
finalWidth = Math.floor(finalHeight * currRatio);
}
}
return {width: finalWidth, height: finalHeight};
}
var size = getSize();
lime.embed("openfl-content", size.width, size.height, "000000");
// Resize document width to fix Samsung Galaxy stock-browser render freeze on touch bug:
if (/Android/.test(navigator.userAgent) && !(/Chrome/.test(navigator.userAgent)))
{
var ds = document.documentElement.style;
var origW = ds.width;
ds.width = "101%";
setTimeout(function() {
ds.width = origW;
}, 500);
}
*
回帖描述:*
链接类型:*
下载链接:*
描述:*
回帖描述:*
链接类型:*
阅读权限:*
下载链接:



聚优部落技术论坛 © 版权所有 鲁ICP备15007479号-6
Copyright(C)web.com, All Rights Reserved.
