Explain the function of static keyword and final keyword in Java in detail>>>
When using JavaScript to get the absolute coordinates of DOM node relative to the page, we need to calculate the scrolling distance of the current page, and the acquisition of this value depends on the browser
You can view the document.body corresponding to & lt; body>& lt;/ body> Document.documentelement is equivalent to the whole HTML, which indicates that browsers have different positions after rendering. FF, opera and IE think that the content of the page displayed in the client browser corresponds to the whole HTML, so document.documentelement is used to represent, The corresponding scrolling distance is obtained by document.documentelement.scrollleft and document.documentelement.scrolltop, while Safari and chrome browsers think that the page starts from the body part, so the corresponding scrolling distance is obtained by document.body.scrollleft and document.body.scrolltop. In addition, it should be noted that in the quirks mode of FF and ie, document. Body is used
For cross browser solutions, you can simply use the following code:
|
Similar Posts:
- A problem with 0 document. Documentelement. Clientwidth
- Document.body.clientheight cannot get the browser page height correctly
- Solve the problem that the browser prompts “DNS” after opening the web page_ probe_ The method of “possible”
- The usage of WebKit text size adjust
- A parser-blocking, cross site (i.e. different eTLD+1) script, is invoked via document.write
- -webkit-text-size-adjust
- Solve the problem of invalid package during chrome plug-in installation: “CRX”_ HEADER_ INVALID”
- Npapi and ppapi problems of “application / x-vlc-plugin not supported”
- Couldn’t resolve host ‘mirrorlist.centos.org
- Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extensi…