国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > Flex > 正文

FLEX給頁面添加滾動條實現思路及代碼

2024-09-08 18:17:23
字體:
來源:轉載
供稿:網友
修改index.template.html,加入一段js獲取瀏覽器窗口的寬高,根據瀏覽器窗口寬高修改css樣式,html, body { height:100%; width:100%; }的height和width是百分比還是具體大小,當是具體大小時就會出現滾動條,當是百分比時就會充滿整個窗口。

具體如下:
1.加入以下js原碼(Application大小為1100X600)
復制代碼 代碼如下:

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();

}
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 寿宁县| 高淳县| 青神县| 乌鲁木齐市| 新疆| 宜城市| 新乐市| 德令哈市| 普宁市| 龙山县| 青田县| 即墨市| 拜城县| 合作市| 兴业县| 习水县| 呼图壁县| 互助| 韶山市| 崇明县| 西丰县| 仙居县| 青冈县| 乌鲁木齐市| 体育| 东兰县| 兰州市| 偃师市| 彩票| 平远县| 邯郸县| 廉江市| 桃园市| 和林格尔县| 商南县| 长垣县| 澄江县| 淮安市| 昌都县| 湘潭县| 淮滨县|