Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

keep-image

shockw4ver15ISC0.0.1

To keep the image's scale in element.

util, image, scale, keep, scale

readme

keep-image

描述


用于保持图片在页面中的纵横比

用法


根据相应的模块规范导入(以下以 CommonJS 为例):

var keepImage = require('keep-image'');

keepImage(el, el.parentNode);

其中el是图片所在元素,即包含src属性的img元素。

经过该工具函数的处理,图片在元素内能总是按照自己的纵横比填满元素


Description


To keep an image's scale in a html element

Usage

Import it by correct module specification(take CommonJS for example here):

var keepImage = require('keep-image'');

keepImage(el, el.parentNode);

el is the img element with attribute src of the image to be kept scale.

By using this function, the image will fill the element while keeping its scale.