Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/will123195/responsive

Simple browser window size checkpoints
https://github.com/will123195/responsive

Last synced: 10 days ago
JSON representation

Simple browser window size checkpoints

Awesome Lists containing this project

README

        

# responsive

Simple window size checkpoints in the browser.

## Install

```
npm i -S responsive
```

## Usage

```js
import responsive from 'responsive'

const opts = {
checkpoints: {
small: {
width: [0, 400]
},
big: {
width: [401, null]
}
}
}
responsive(opts, data => {
// This callback fires immediately and whenever the window size changes
console.log(data)
// {
// width: 824,
// height: 977,
// square: false,
// portrait: true,
// landscape: false,
// matches: ['big']
// }
})
```