Skip to content

Commit

Permalink
Fix subpixel scrollbar calculation logic + add tests for it.
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasramo committed Oct 25, 2023
1 parent 0370822 commit 0911de9
Show file tree
Hide file tree
Showing 12 changed files with 443 additions and 38 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ getOffset([elemA, 'padding'], [elemB, 'margin']);

Returns the width of an element in pixels. Accepts also the window object (for getting the viewport width) and the document object (for getting the width of the document). Document width, in the context of this method, is either the document element's width (including it's scroll area) or window's width (without possible scrollbar), whichever is greater.

This method also measures custom subpixel scrollbar sizes accurately, which is something you don't bump into too often, but might be extremely important in those special cases where the site has custom subpixel scrollbars defined.

**Syntax**

```ts
Expand Down Expand Up @@ -226,6 +228,8 @@ getWidth(elem, 'margin');

Returns the height of an element in pixels. Accepts also the window object (for getting the viewport height) and the document object (for getting the height of the whole document). Document height, in the context of this method, is either the document element's height (including it's scroll area) or window's height (without possible scrollbar), whichever is greater.

This method also measures custom subpixel scrollbar sizes accurately, which is something you don't bump into too often, but might be extremely important in those special cases where the site has custom subpixel scrollbars defined.

**Syntax**

```ts
Expand Down
2 changes: 1 addition & 1 deletion dist/cjs/utils/getPreciseScrollbarSize.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/esm/utils/getPreciseScrollbarSize.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 0911de9

Please sign in to comment.