100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > 获取页面高度窗口高度滚动条高度等参数值getPageSize getPageScroll

获取页面高度窗口高度滚动条高度等参数值getPageSize getPageScroll

时间:2022-10-01 22:42:25

相关推荐

获取页面高度窗口高度滚动条高度等参数值getPageSize getPageScroll

最近很多朋友喜欢上设计,但是大家却不知道如何去做,别担心有给你解答,史上最全最棒的详细解说让你一看就懂。

代码如下:

function getPageScroll(){

var yScroll;

if () {

yScroll = ;

} else if ( && .scrollTop){ // Explorer 6 Strict

yScroll = .scrollTop;

} else if () {// all other Explorers

yScroll = .scrollTop;

}

arrayPageScroll = new Array(\,yScroll)

return arrayPageScroll;

}

function getPageSize(){

var xScroll, yScroll;

if ( && ) {

xScroll = .scrollWidth;

yScroll = + ;

} else if (.scrollHeight .offsetHeight){ // all but Explorer Mac

xScroll = .scrollWidth;

yScroll = .scrollHeight;

} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari

xScroll = .offsetWidth;

yScroll = .offsetHeight;

}

var windowWidth, windowHeight;

if () { // all except Explorer

windowWidth = ;

windowHeight = ;

} else if ( && .clientHeight) { // Explorer 6 Strict Mode

windowWidth = .clientWidth;

windowHeight = .clientHeight;

} else if () { // other Explorers

windowWidth = .clientWidth;

windowHeight = .clientHeight;

}

// for small pages with total height less then height of the viewport

if(yScroll windowHeight){

pageHeight = windowHeight;

} else {

pageHeight = yScroll;

}

if(xScroll windowWidth){

pageWidth = windowWidth;

} else {

pageWidth = xScroll;

}

arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)

return arrayPageSize;

}

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。