keep-image

0.0.1 • Public • Published

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.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.1
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.1
    1

Package Sidebar

Install

npm i keep-image

Weekly Downloads

1

Version

0.0.1

License

ISC

Last publish

Collaborators

  • shockw4ver