Summary of accurate calculations of various distances/scroll distances in a window

Summary of accurate calculations of various distances/scroll distances in a window
Usually in project development, we have to deal with margins, positions, coordinates and so on. The tragedy is that if you don’t have a very clear concept of these things, it will be very painful when coding, and you will have to look for information everywhere for the accurate calculation of distance. pain. . . .
Today I had a more practical need. I wanted to get the scrolling distance of the window. I remember it was scrollTop and scrollLeft. When I was looking for information, I found a very useful diagram.

Okay, now that the picture is up, I don't think I need to explain too much. In the future, when you encounter issues with client, offset, scroll, or various margin issues with style content, you don't have to worry about them anymore. Just look at this picture and everything will be solved.

<<:  Solution to mysql error when modifying sql_mode

>>:  Summary of Button's four Click response methods

Recommend

Linux platform mysql enable remote login

During the development process, I often encounter...

Implementation of MySQL scheduled backup script under Windows

On a Windows server, if you want to back up datab...

HTML optimization speeds up web pages

Obvious HTML, hidden "public script" Th...

Introduction to CSS3 color value RGBA and gradient color usage

Before CSS3, gradient images could only be used a...

Detailed explanation of MySQL cursor concepts and usage

This article uses examples to explain the concept...

CSS sample code with search navigation bar

This article shows you how to use CSS to create a...

Linux command line quick tips: How to locate a file

We all have files stored on our computers -- dire...

How to split and merge multiple values ​​in a single field in MySQL

Multiple values ​​combined display Now we have th...

Common JavaScript memory errors and solutions

Table of contents 1. Timer monitoring 2. Event mo...

HTML uses regular expressions to test table examples

Here is an example code for using regular express...

MySQL 8.0.12 installation steps and basic usage tutorial under Windows

This article shares the installation steps and us...