1.0.17 • Published 2 years ago

get-viewport-sizes v1.0.17

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Installation

npm install get-viewport-sizes

To use, call getSizes() at the top of your entry file to populate --vh and --vw

import { getSizes } from 'get-viewport-sizes';
getSizes(200); // where 200 (default) is the timeout for debounce 

You may then use the var in css like this

main {
    height: var(--vh * 0.8)  //80% of vh
}

React Hook

You may also use React hook to get the updated with and height

const { width, height } = useGetViewportSizes(200) // where 200(default) is the timeout for debounce

Hook will return width and height as float

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

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