1.0.3 • Published 5 years ago

frodo-lazy-img v1.0.3

Weekly downloads
1
License
ISC
Repository
github
Last release
5 years ago

Lazy-Img

this is only a simple react lazy loading component. As the main purpose is to learn how to use npm publish.

In case someone may accidently dependent on the poor lib. Here is the Github where he/she can report bugs or just to tell the unsatisfactory :D

Install

npm install --save lazy-laod

Usage

Simply import and use it as a <img />

offsetcould be set to tell how many pixels to load image before the actual position.

import LazyLoad from 'lazy-load';
import React from 'react';

export default () => {
    return (
        <LazyLoad src={/**/} offset={200} />
    );
}

API

PropertiesDescription
srcthe src of the image
offsetif set, this will set a pilot to tell the browser to prefetch
retryretry times when the loading is fail.
onLoadStartexpose a method to invoke when image start, success, fail to load.
onLoadSuccess
onLoadFailed

Browser Supporting

This component doesn't support IE, Safari and Oepera for the missing of IntersectionObserver API

I added an option to deal with those browser which doesn't support IntersectionObserver API

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.6

5 years ago

0.1.5

5 years ago

0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago