2.1.7 • Published 11 months 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-fitter
Usage
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
11 months ago
2.1.7
11 months ago
2.1.5
2 years ago
2.1.2
2 years ago
2.0.3
2 years ago
2.1.1
2 years ago
2.0.2
2 years ago
2.1.4
2 years ago
2.0.5
2 years ago
2.1.3
2 years ago
2.0.4
2 years ago
2.0.11
2 years ago
2.0.7
2 years ago
2.0.6
2 years ago
2.0.9
2 years ago
2.0.10
2 years ago
2.0.8
2 years ago
2.1.0
2 years ago
2.0.1
2 years ago
2.0.0
2 years ago
1.2.2
2 years ago
1.2.1
2 years ago
1.2.0
2 years ago
1.1.10
2 years ago
1.1.9
2 years ago
1.1.8
2 years ago
1.1.7
2 years ago
1.1.6
2 years ago
1.1.5
2 years ago
1.1.4
2 years ago
1.1.3
2 years ago
1.1.2
2 years ago
1.1.1
2 years ago
1.1.0
2 years ago
1.0.3
2 years ago
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago