Getpagesize, getpagescroll

Source: Internet
Author: User

CopyCode The Code is as follows: function getpagescroll (){
VaR yscroll;
If (self. pageyoffset ){
Yscroll = self. pageyoffset;
} Else if (document.doc umentelement & document.doc umentelement. scrolltop) {// Explorer 6 strict
Yscroll = document.doc umentelement. scrolltop;
} Else if (document. Body) {// all other referers
Yscroll = Document. Body. scrolltop;
}

Arraypagescroll = new array ('', yscroll)
Return arraypagescroll;
}

function getpagesize () {
var xscroll, yscroll;
If (window. innerheight & window. scrollmaxy) {
xscroll = document. body. scrollwidth;
yscroll = Window. innerheight + window. scrollmaxy;
}else if (document. body. scrollheight> document. body. offsetheight) {// all but explorer Mac
xscroll = document. body. scrollwidth;
yscroll = document. body. scrollheight;
}else {// explorer Mac... wocould also work in Explorer 6 strict, Mozilla and Safari
xscroll = document. body. offsetwidth;
yscroll = document. body. offsetheight;
}

VaR implements wwidth, implements wheight;
If (self. innerheight) {// All privileges t Explorer
Required wwidth = self. innerwidth;
Optional wheight = self. innerheight;
} Else if (document.doc umentelement & document.doc umentelement. clientheight) {// Explorer 6 strict Mode
Required wwidth = document.doc umentelement. clientwidth;
Required wheight = document.doc umentelement. clientheight;
} Else if (document. Body) {// other explorers
Required wwidth = Document. Body. clientwidth;
Optional wheight = Document. Body. clientheight;
}

// For small pages with total height less then height of the viewport
If (yscroll <windowheight ){
Pageheight = running wheight;
} Else {
Pageheight = yscroll;
}

If (xscroll <1_wwidth ){
Pagewidth = required wwidth;
} Else {
Pagewidth = xscroll;
}

arraypagesize = new array (pagewidth, pageheight, expires wwidth, expires wheight)
return arraypagesize;
}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.