Skip to content

Commit 29c5077

Browse files
added: documentation
1 parent d6a8e20 commit 29c5077

File tree

2 files changed

+54
-8
lines changed

2 files changed

+54
-8
lines changed

README.md

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,60 @@
66
[![NPM downloads][npm-downloads-image]][npm-url]
77
[![MIT License][license-image]][license-url]
88

9+
[travis-image]: https://img.shields.io/travis/biancojs/viewport.svg?style=flat-square
910

10-
[travis-image]:https://img.shields.io/travis/biancojs/viewport.svg?style=flat-square
11-
[travis-url]:https://travis-ci.org/biancojs/viewport
11+
[travis-url]: https://travis-ci.org/biancojs/viewport
1212

13-
[license-image]:http://img.shields.io/badge/license-MIT-000000.svg?style=flat-square
14-
[license-url]:LICENSE.txt
13+
[license-image]: http://img.shields.io/badge/license-MIT-000000.svg?style=flat-square
1514

16-
[npm-version-image]:http://img.shields.io/npm/v/bianco.viewport.svg?style=flat-square
17-
[npm-downloads-image]:http://img.shields.io/npm/dm/bianco.viewport.svg?style=flat-square
18-
[npm-url]:https://npmjs.org/package/bianco.viewport
15+
[license-url]: LICENSE.txt
16+
17+
[npm-version-image]: http://img.shields.io/npm/v/bianco.viewport.svg?style=flat-square
18+
19+
[npm-downloads-image]: http://img.shields.io/npm/dm/bianco.viewport.svg?style=flat-square
20+
21+
[npm-url]: https://npmjs.org/package/bianco.viewport
1922

2023
## API
2124

25+
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
26+
27+
### scrollbarWidth
28+
29+
Return the size of the scrollbar that depends on the browser or device used on the client
30+
31+
Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the browser scrollbar width
32+
33+
### documentHeight
34+
35+
Get the height of the whole page
36+
37+
Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** height in px of the document
38+
39+
### documentWidth
40+
41+
Get the width of the whole page
42+
43+
Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** width in px of the document
44+
45+
### scrollTop
46+
47+
Return amount of px scrolled from the top of the document
48+
49+
Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** scroll top value in px
50+
51+
### scrollLeft
52+
53+
Return amount of px scrolled from the top of the document
54+
55+
Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** scroll left value in px
56+
57+
### elementOffsetTop
58+
59+
Get the offset top of any DOM element
60+
61+
**Parameters**
62+
63+
- `el` **[HTMLElement](https://developer.mozilla.org/en-US/docs/Web/HTML/Element)** the element we need to check
64+
65+
Returns **[Number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** the element y position in px

index.next.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ const ZERO = 0
66

77
/**
88
* Simple function convert in boolean any value and return true if its value was truthy
9+
* @private
910
* @param {*} v - anything
1011
* @returns { Boolean } true if truthy
1112
*/
1213
const isTruthy = v => !!v
1314

1415
/**
1516
* Get the max value from a list of arguments filtering the falsy values
17+
* @private
1618
* @param {...Number} args - list of numbers
1719
* @returns { Number } the highest value
1820
*/
@@ -84,7 +86,7 @@ export function scrollTop() {
8486

8587
/**
8688
* Return amount of px scrolled from the top of the document
87-
* @returns { Number } scroll top value in px
89+
* @returns { Number } scroll left value in px
8890
*/
8991
export function scrollLeft() {
9092
return max(

0 commit comments

Comments
 (0)