screen-flexible

1.2.2 • Public • Published

screen-flexible

Adaptive solution for screen page.

Language

Installation

npm install screen-flexible

Usage

The screen resolution is: 1920*1080

import 'screen-flexible/dist/auto'

The screen resolution is custom, eg: 1600*1000

import { bodyResize } from 'screen-flexible'

let timer
window.addEventListener('resize', () => {
  clearTimeout(timer)
  timer = setTimeout(() => { bodyResize(1600, 1000) }, 300)
})

bodyResize(1600, 1000)

Type option

import { bodyResize } from 'screen-flexible'

/**
 * Types of resize method
 * 'padding': default, use the minimum axis scale and maximum axis will be padding with blank
 * 'width': use the x-axis scale
 * 'height': use the y-axis scale
 * 'full': use both x-axis and y-axios scale to fullfill the screen
*/

let timer
window.addEventListener('resize', () => {
  clearTimeout(timer)
  timer = setTimeout(() => { bodyResize(1920, 1080, 'full') }, 300)
})

bodyResize(1920, 1080, 'full')

Readme

Keywords

none

Package Sidebar

Install

npm i screen-flexible

Weekly Downloads

2

Version

1.2.2

License

MIT

Last publish

Collaborators

  • xiaoping