lazyplace
v0.0.0
Published
Set width and height of image elements that will be lazily loaded
Downloads
4
Maintainers
Readme
lazyplace
A Node module to set element sizes of HTML.
<div class='.responsive-image-wrapper'>
<img alt='' src='placeholder.gif' data-src='image_ratio-16-9.jpg'>
</div>
↓
<div class='.responsive-image-wrapper' styles='height: 0; padding-bottom: 56.25%;'>
<img alt='' src='placeholder.gif' data-src='image_ratio-16-9.jpg'>
</div>
Installation
Install with npm. (Make sure you have installed Node.)
npm install --save lazyplace
API
var lazyPlace = require('lazyplace');
lazyPlace(filename, options, callback)
options.attr
Type: String
(Required)
options.selector
Type: String
(Required)
options.baseDir
Type: String
options.responsive
Type: Boolean
It returns a Number
of heading level, when the argument is a heading tag name, such as "h3"
and "H4"
.
It returns null
when the argument is not a heading tag name.
It throws an error when the argument is not a String
.
var result = [];
for(var i = 0; i <= 7; i++) {
result.push(headingLevel('h' + i));
}
result; //=> [null, 1, 2, 3, 4, 5, 6, null]
lazyPlace.htmlString(string, options, callback)
License
Copyright (c) 2014 Shinnosuke Watanabe
Licensed under the MIT LIcense.