2.1.7 • Published 2 years ago
react-page-fitter v2.1.7
react-page-fitter
This is a React hooks that observe HTML element fits within the current viewport or element.
It's the for building more complex UI.
Installation
npm install react-page-fitterUsage
import useFitter from 'react-page-fitter'
function MyComponent() {
const pathname = // useLocation...
const isFit = useFitter('.class')
return isFit && <CustomComponents/>
}API
useFitter (argument, options)
return value boolean | undefined.
Returns undefined if an invalid argument is passed.
Argument
| Parameter | Meaning |
|---|---|
| target (required) | The judgement target element by tag, className or id |
Options(object)
| Field | Key |
|---|---|
| offsetX | Horizontal viewport offsetX number when not using parentBox, The default value is 0 |
| offsetY | Vertical viewport offsetY number when not using parentBox, The default value is 0 |
| parentBox | The judgement parentBox element by tag, className or id is judged in place of the viewport, default undefined |
| pathname | The dynamic pathname to render when placing at layout level |
License
The MIT License.
2.1.6
2 years ago
2.1.7
2 years ago
2.1.5
2 years ago
2.1.2
3 years ago
2.0.3
3 years ago
2.1.1
3 years ago
2.0.2
3 years ago
2.1.4
3 years ago
2.0.5
3 years ago
2.1.3
3 years ago
2.0.4
3 years ago
2.0.11
3 years ago
2.0.7
3 years ago
2.0.6
3 years ago
2.0.9
3 years ago
2.0.10
3 years ago
2.0.8
3 years ago
2.1.0
3 years ago
2.0.1
3 years ago
2.0.0
3 years ago
1.2.2
3 years ago
1.2.1
3 years ago
1.2.0
3 years ago
1.1.10
3 years ago
1.1.9
3 years ago
1.1.8
3 years ago
1.1.7
3 years ago
1.1.6
3 years ago
1.1.5
3 years ago
1.1.4
3 years ago
1.1.3
3 years ago
1.1.2
3 years ago
1.1.1
3 years ago
1.1.0
3 years ago
1.0.3
3 years ago
1.0.2
3 years ago
1.0.1
3 years ago
1.0.0
3 years ago