For the various location attributes in javascript, what is previously required when writing special effects is used, and the system has not summarized them seriously. Location attributes play an important role in many special effects. If the browser has the same interpretation of each attribute, we do not need to waste too much effort, because different browsers have different interpretations for each attribute.
This article covers the attributes of various locations of various mainstream objects. If there are any errors or omissions, please do not cherish your text.
To sum up these attributes, you can also give yourself an explanation.
Window object
- InnerHeight
- InnerWidth
- OuterHtight
- OuterWidth
- PageXOffset
- PageXOffset
- ScreenLeft
- ScreenTop
- ScreenX
- ScreenY
InnerHeight innerWidth
InnerHeight |
Return the height of the document display area in the window. |
InnerWidth |
Return window document County/City width |
Browser compatibility:
Instance code: [test in FF]
Effect implementation:
OuterHeight outerWidth
OuterHeight |
Return the external height of the window, including the toolbar and scroll bar. |
OuterWidth |
Return the external width of the window, including the toolbar and scroll bar. |
Browser compatibility:
Code implementation: [test in FF]
Effect implementation:
PageXOffset pageYOffset
PageXOffset |
Declares the number of vertices that have been rolled to the right of the current document. |
PageYOffset |
Declare the number of vertices that have been rolled down in the current document |
IE does not support these attributes. IE uses the scrollLeft and scrollTop attributes of document. dacumentElement or document. body.
Browser compatibility:
Instance code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
1111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> 2 <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> </body>
Effect example:
ScreenTop screenLeft screenX screenY
ScreenTop |
A read-only integer that declares the Y coordinate in the upper left corner of the window. |
ScreenLeft |
A read-only integer that specifies the X coordinate in the upper left corner of the window. |
ScreenX |
A read-only integer that specifies the X coordinate in the upper left corner of the window. |
ScreenY |
A read-only integer that declares the Y coordinate in the upper left corner of the window. |
Browser compatibility:
ScreenTop screenLeft
ScreenX screenY
Instance code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
Effect example:
Test in Chrom:
Test in FF: