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.

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i keep-image

      Weekly Downloads

      0

      Version

      0.0.1

      License

      ISC

      Last publish

      Collaborators

      • shockw4ver