最近很多朋友喜欢上设计,但是大家却不知道如何去做,别担心有给你解答,史上最全最棒的详细解说让你一看就懂。
代码如下:
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;
}