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

https://github.com/ymzuiku/vanilla-device

device checker
https://github.com/ymzuiku/vanilla-device

Last synced: about 2 months ago
JSON representation

device checker

Awesome Lists containing this project

README

        

# vanilla-device

- Get mobile device detail
The introduction of mobile-touch, if the device is a mobile device, can make the whole page scroll closer to native and support Typescript

## Install

unpkg:

```html

```

npm:

```sh
$ npm install --save vanilla-device
```

## Feature

### 1. Get Device details:

```js
import "vanilla-device";

console.log(vanillaDevice.isPc());
console.log(vanillaDevice.isIPhoneX());
console.log(vanillaDevice.safeTop());
```

### 2. Safe CSS:

1. import package

```js
import vanillaDevice from "vanilla-device";
```

2. use css value

```css
.page {
padding-top: var(--safe-top);
padding-bottom: var(--safe-bottom);
}
```

3. If your use CSS-IN-JS

```js
import vanillaDevice from "vanilla-device";

const safeTop = vanillaDevice.safeTop();

;
```

### 5. Keyboard:

1. When the iOS keyboard appears, click the blank area to automatically close the keyboard
2. Automatically adjust the scroll area when the iOS keyboard appears

```js
import vanillaDevice from "vanilla-device";

vanillaDevice.setKeyboardAutoHide();
```