-
Notifications
You must be signed in to change notification settings - Fork 227
Element size and scrolling #433
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
joaquinelio
merged 49 commits into
javascript-tutorial:master
from
lgabrielvleon:lgabrielvleon-patch-1
Dec 17, 2020
Merged
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
18a2e99
Update solution.md
lgabrielvleon ba5c94e
Update task.md
lgabrielvleon 5226df4
Update solution.md
lgabrielvleon 9c9b64f
Update task.md
lgabrielvleon ca42219
Update solution.md
lgabrielvleon 466734d
Update task.md
lgabrielvleon 9740728
Update solution.md
lgabrielvleon 2e0bd7c
Update task.md
lgabrielvleon 086ae04
Update index.html
lgabrielvleon db46b72
Update article.md
lgabrielvleon 6439b88
Update article.md
lgabrielvleon 2b32f2b
Update article.md
lgabrielvleon cf550f5
Update article.md
lgabrielvleon 3763bb4
Update article.md
lgabrielvleon b5522eb
alineando
joaquinelio 3a695f6
Update 2-ui/1-document/09-size-and-scroll/6-width-vs-clientwidth/task.md
lgabrielvleon ad78fbb
Update 2-ui/1-document/09-size-and-scroll/1-get-scroll-height-bottom/…
lgabrielvleon 9821cfd
Update 2-ui/1-document/09-size-and-scroll/article.md
lgabrielvleon ea2eabf
Update 2-ui/1-document/09-size-and-scroll/article.md
lgabrielvleon 1c91fcb
Update 2-ui/1-document/09-size-and-scroll/article.md
lgabrielvleon 64e7ef4
Update 2-ui/1-document/09-size-and-scroll/article.md
lgabrielvleon 5889c25
Update 2-ui/1-document/09-size-and-scroll/2-scrollbar-width/task.md
lgabrielvleon 28eb465
Update 2-ui/1-document/09-size-and-scroll/2-scrollbar-width/task.md
lgabrielvleon 989c60b
Update 2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/soluti…
lgabrielvleon 1e1a2bd
Update 2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/soluti…
lgabrielvleon bb6abd8
Update 2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/soluti…
lgabrielvleon 4d76cf2
Update 2-ui/1-document/09-size-and-scroll/article.md
lgabrielvleon dd0e94f
Update 2-ui/1-document/09-size-and-scroll/2-scrollbar-width/task.md
lgabrielvleon 3d6a862
Update 2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/task.md
lgabrielvleon 669d366
Update 2-ui/1-document/09-size-and-scroll/6-width-vs-clientwidth/solu…
lgabrielvleon b63c3a4
Update 2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/task.md
lgabrielvleon 0f2480e
Update 2-ui/1-document/09-size-and-scroll/6-width-vs-clientwidth/solu…
lgabrielvleon 980057b
Update solution.md
lgabrielvleon f7ff985
Update 2-ui/1-document/09-size-and-scroll/2-scrollbar-width/solution.md
vplentinax ddb54ac
Update 2-ui/1-document/09-size-and-scroll/2-scrollbar-width/task.md
vplentinax 00ed4fc
Update 2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/task.md
vplentinax 9d315d0
Update 2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/task.md
vplentinax 8012f83
Update 2-ui/1-document/09-size-and-scroll/6-width-vs-clientwidth/solu…
vplentinax 62bca3f
Update 2-ui/1-document/09-size-and-scroll/6-width-vs-clientwidth/task.md
vplentinax cd7e165
Update 2-ui/1-document/09-size-and-scroll/article.md
vplentinax 9970a93
Update 2-ui/1-document/09-size-and-scroll/article.md
vplentinax 1344926
Update 2-ui/1-document/09-size-and-scroll/article.md
vplentinax 29120e2
Update 2-ui/1-document/09-size-and-scroll/article.md
vplentinax 25f7874
Update 2-ui/1-document/09-size-and-scroll/article.md
vplentinax 601704f
Update 2-ui/1-document/09-size-and-scroll/article.md
vplentinax 4e51234
Update 2-ui/1-document/09-size-and-scroll/article.md
vplentinax 41d06ed
Update 2-ui/1-document/09-size-and-scroll/article.md
vplentinax d5be71f
Update 2-ui/1-document/09-size-and-scroll/article.md
vplentinax 08f1899
Update 2-ui/1-document/09-size-and-scroll/article.md
vplentinax File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
4 changes: 2 additions & 2 deletions
4
2-ui/1-document/09-size-and-scroll/1-get-scroll-height-bottom/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
The solution is: | ||
La solución es: | ||
|
||
```js | ||
let scrollBottom = elem.scrollHeight - elem.scrollTop - elem.clientHeight; | ||
``` | ||
|
||
In other words: (full height) minus (scrolled out top part) minus (visible part) -- that's exactly the scrolled out bottom part. | ||
En otras palabras: (altura total) menos (parte superior desplazada) menos (parte visible) -- esa es exactamente la parte inferior desplazada. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
2-ui/1-document/09-size-and-scroll/2-scrollbar-width/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 14 additions & 14 deletions
28
2-ui/1-document/09-size-and-scroll/4-put-ball-in-center/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
2-ui/1-document/09-size-and-scroll/6-width-vs-clientwidth/solution.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Differences: | ||
Diferencias: | ||
|
||
1. `clientWidth` is numeric, while `getComputedStyle(elem).width` returns a string with `px` at the end. | ||
2. `getComputedStyle` may return non-numeric width like `"auto"` for an inline element. | ||
3. `clientWidth` is the inner content area of the element plus paddings, while CSS width (with standard `box-sizing`) is the inner content area *without paddings*. | ||
4. If there's a scrollbar and the browser reserves the space for it, some browser substract that space from CSS width (cause it's not available for content any more), and some do not. The `clientWidth` property is always the same: scrollbar size is substracted if reserved. | ||
1. `clientWidth` es numérico, mientras `getComputedStyle(elem).width` retorna una cadena con `px` en el final. | ||
2. `getComputedStyle` puede devolver un ancho no numérico como `"auto"` para un elemento en linea. | ||
3. `clientWidth` es el contenido interior del área del elemento más los rellenos, mientras el ancho de CSS (con el estándar `box-sizing`) es el contenido interior del área *sin rellenos*. | ||
4. Si hay una barra de desplazamiento y el navegador reserva espacio para esta, algunos navegadores restan ese espacio del ancho de CSS (por que no está disponible para el contenido), y otros no. La propiedad `clientWidth` es siempre la misma: el tamaño de la barra de desplazamiento se resta si está reservado. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.