Skip to content

4matic/react-lazysizes

 
 

Repository files navigation

React LazySizes

Update to 1.1.0 to use with latest react and prop-types

LazySizes component for ReactJS base on lazysizes

Installation

NPM

npm install --save react-lazysizes

Bower

bower install --save react-lazysizes

Usage

JS

var LazySizes = require('react-lazysizes');

<LazySizes width='1920' height='1024' dataSrc='http://lorempixel.com/1920/1024/sports/1'/>

UMD

<script src="path/to/react-lazysizes/dist/react-lazysizes.js"></script>
//...
var LazySizes = window.ReactLazysizes;
//...

Example here

Props

Name Type Default
src string 'data:image/gif;base64,R0lGODdhEAAJAIAAAMLCwsLCwiwAAAAAEAAJAAACCoSPqcvtD6OclBUAOw=='
dataSrc string
dataSizes string 'auto'
dataSrcSet [string, object, array]
className string ''
iframe bool false

More info see lazysizes api.

Example

View demo or example folder.

About

LazySizes component for ReactJS base on lazysizes

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 94.6%
  • CSS 4.5%
  • HTML 0.9%