Client/scroll/offset width/height/top/left, scroloffset

Source: Internet
Author: User

Client/scroll/offset width/height/top/left, scroloffset

Client/scroll/offset width/height/top/left (the box model is contentBox, and the origin is the intersection of the outermost layers of the border in the upper left corner of the element)

ClientWidth width + Left padding + right padding (if a vertical scroll bar exists, subtract 17px)
ClientHeight height + upper padding + lower padding (if a horizontal scroll bar exists, 17px is subtracted)
ClientTop border-top-width Upper border width
ClientLeft border-left-width left border width
OffsetHeight
OffsetWidth borderLeftWidth + paddingLeft + width + paddingRight + borderRightWidth
OffsetLeft: The left offset of the current element origin point relative to the inner point of the border in the upper left corner of the parent element.
OffsetTop the offset of the current element origin point relative to the top focus of the bottom border in the upper left corner of the parent Element
OffsetParent parent element relative to offset
ScrollHeight
If the element does not have a vertical scroll bar, paddingLeft + width + paddingRight.
If there is a vertical scroll bar, it is related to the width occupied by the content. The specific calculation is not clear yet.
ScrollWidth
Similar to the above
The length of the scrollLeft horizontal scroll bar.
Length of scrollTop vertical scroll bar rolled over


A js and css problem. Get the distance between the div of absolute and the body, that is, left and right.

To solve this problem, first confirm who your offsetParent is. If its parent level is set relative position, absolute, and fixed, then offsetParent is the tag, offsetLeft \ Top is the position relative to this tag. However, jquery is easy to get.
Var offsetobj = $ ("# aaa"). offset ();
Var left = offsetobj. left;
Var top = offsetobj. top;

How to store the DIV attribute (TOP, LEFT, HEIGHTWIDTH) into the database, and then read it and pay it to the DIV

<Script type = "text/javascript" language = "javascript">
<! --
Function checkBrowser ()
{
Var ClientInfo = "";
ClientInfo = ClientInfo + "userAgent:" + window. navigator. userAgent + "<br> ";
ClientInfo = ClientInfo + "appName:" + window. navigator. appName + "<br> ";
ClientInfo = ClientInfo + "appVersion:" + window. navigator. appVersion + "<br> ";
ClientInfo = ClientInfo + "appMinorVersion:" + window. navigator. appMinorVersion + "<br> ";
ClientInfo = ClientInfo + "appCodeName:" + window. navigator. appCodeName + "<br> ";
ClientInfo = ClientInfo + "platform:" + window. navigator. platform + "<br> ";
ClientInfo = ClientInfo + "language:" + window. navigator. language + "<br> ";
ClientInfo = ClientInfo + "userLanguage:" + window. navigator. userLanguage + "<br> ";
ClientInfo = ClientInfo + "cpuClass:" + window. navigator. cpuClass + "<br> ";
ClientInfo = ClientInfo + "onLine:" + window. navigator. onLine + "<br> ";
// ClientInfo = ClientInfo + "javaEnabled:" + window. navigator. javaEnabled + "<br> ";
ClientInfo =... the remaining full text>
 

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.