npm.io
0.0.1 • Published 9 years ago

keep-image

Licence
ISC
Version
0.0.1
Deps
0
Vulns
0
Weekly
0

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.

Keywords