1. getBoundingClientRect() Analysis
grammar
valuerectObject.top: the distance from the top of the element to the top of the window; rectObject.right: the distance from the right side of the element to the left side of the window; rectObject.bottom: the distance from the bottom of the element to the top of the window; rectObject.left: the distance from the left side of the element to the left side of the window; rectObject.width: is the width of the element itself rectObject.height is the height of the element itself Cross-browser compatibilityIf you need better cross-browser compatibility, use window.pageXOffset and window.pageYOffset instead of window.scrollX and window.scrollY. Scripts that do not have access to these properties can use the following code: // For scrollX (((t = document.documentElement) || (t = document.body.parentNode)) && typeof t.scrollLeft == 'number' ? t : document.body).scrollLeft // For scrollY (((t = document.documentElement) || (t = document.body.parentNode)) && typeof t.scrollTop == 'number' ? t : document.body).scrollTop Example // rect is a DOMRect object with four properties: left, top, right, bottom Note: DOMRect is the standard name for TextRectangle or ClientRect, they are the same. This is the end of this article about the detailed case of the getBoundingClientRect() method in js. For more relevant content about getBoundingClientRect() in js, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: MySQL free installation version (zip) installation and configuration detailed tutorial
>>: How to reset Zabbix password (one-step)
Preface: In the daily use of the database, it is ...
First, take a look at Alibaba Cloud's officia...
Install MySQL under Windows for your reference. T...
Table of contents Overview Index data structure B...
I don’t know why, but UI likes to design honeycom...
External Access Randomly map ports Using the -P f...
In our daily business, form validation is a very ...
This article shares the specific code of js to re...
When changing the time zone under Linux, it is al...
Table of contents environment summary Module Func...
When using docker images, images with both REPOSI...
Table of contents 01 Common controllers in k8s RC...
background: Since the company's projects seem...
I have been quite free recently. I have been doin...
Scenario: As the amount of data increases, the di...