2个回答
2015-07-07
展开全部
修改index.template.html,加入一段js获取浏览器窗口的宽高;
根据浏览器窗口宽高修改css样式,html, body { height:100%; width:100%; }的height和width是百分比还是具体大小,当是具体大小时就会出现滚动条,当是百分比时就会充满整个窗口。
具体如下:
var
winWidth = 0;
var
winHeight = 0;
function
findDimensions()
{
//获取窗口宽度
if
(window.innerWidth)
{
winWidth
= window.innerWidth;
}
else
if
((document.body) && (document.body.clientWidth))
{
winWidth
= document.body.clientWidth; //获取窗口高度
}
if
(window.innerHeight)
{
winHeight
= window.innerHeight;
}
else
if
((document.body) && (document.body.clientHeight))
{
winHeight
= document.body.clientHeight;
}
//通过深入Document内部对body进行检测,获取窗口大小
if
(document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth)
{
winHeight
= document.documentElement.clientHeight;
winWidth
= document.documentElement.clientWidth;
}
var
cssSize = document.styleSheets[0].rules||document.styleSheets[0].cssRules;
if(winWidth
< 1100)
{
cssSize[0].style.width
= "1100px";
}
else
{
cssSize[0].style.width
= "100%";
}
if(winHeight
< 600)
{
cssSize[0].style.height
= "600px";
}
else
{
cssSize[0].style.height
= "100%";
}
}
window.onresize=findDimensions;
function
pageInit() {
//调用函数,获取数值
findDimensions();
}
根据浏览器窗口宽高修改css样式,html, body { height:100%; width:100%; }的height和width是百分比还是具体大小,当是具体大小时就会出现滚动条,当是百分比时就会充满整个窗口。
具体如下:
var
winWidth = 0;
var
winHeight = 0;
function
findDimensions()
{
//获取窗口宽度
if
(window.innerWidth)
{
winWidth
= window.innerWidth;
}
else
if
((document.body) && (document.body.clientWidth))
{
winWidth
= document.body.clientWidth; //获取窗口高度
}
if
(window.innerHeight)
{
winHeight
= window.innerHeight;
}
else
if
((document.body) && (document.body.clientHeight))
{
winHeight
= document.body.clientHeight;
}
//通过深入Document内部对body进行检测,获取窗口大小
if
(document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth)
{
winHeight
= document.documentElement.clientHeight;
winWidth
= document.documentElement.clientWidth;
}
var
cssSize = document.styleSheets[0].rules||document.styleSheets[0].cssRules;
if(winWidth
< 1100)
{
cssSize[0].style.width
= "1100px";
}
else
{
cssSize[0].style.width
= "100%";
}
if(winHeight
< 600)
{
cssSize[0].style.height
= "600px";
}
else
{
cssSize[0].style.height
= "100%";
}
}
window.onresize=findDimensions;
function
pageInit() {
//调用函数,获取数值
findDimensions();
}
展开全部
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
>
<s:Scroller id="Detail" width="100%" height="100%" top="35" visible="false">
<s:Group>
<s:layout>
<s:VerticalLayout gap="0" verticalAlign="middle"/>
</s:layout>
<label/>
</s:Group>
</s:Scroller>
</s:Application>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
>
<s:Scroller id="Detail" width="100%" height="100%" top="35" visible="false">
<s:Group>
<s:layout>
<s:VerticalLayout gap="0" verticalAlign="middle"/>
</s:layout>
<label/>
</s:Group>
</s:Scroller>
</s:Application>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询