lazy-masonry

1.0.1 • Public • Published

lazy-masonry

A Simple Lazy Masonry for JavaScript

Version Downloads/week License All Contributors oclif

Getting Started

Installation

  • with NPM

    $ npm install lazy-masonry

Demo

https://lazy-masonry.web.app

How to use it

It's a pretty easy to use this library. This is the usage example :

 
// for the first add this div tag inside body
 
<div id="lazy-masonry"></div>
 
// add this line only if installed via npm 
import LazyMasonry from 'lazy-masonry';
                
// creating object masonry, you can pass options to it
var masonry = new LazyMasonry('lazy-masonry', {
    images: 5,
    width: 800,
    animateable: true,
    animationType: 'from-top',
    animationDuration: '1s'
});
 
animation types are ["from-top", "from-top-left", "from-top-right", "from-right", "from-left", "from-bottom"]
 
// now you have masonry object and can add images to it
 
// this will add one element 
masonry.add({uri: 'example-image.jpg'}, successCalback, errorCalback);
 
// this will add all elements of array
masonry.runWithArray([{uri: 'example-image.jpg'}, {uri: 'example-image.jpg'}]);
 
// you can listen to every click on elements
masonry.onclick((item) => {
    console.log(item);
});                
 

Contributors ✨

Rafael Muradyan
Rafael Muradyan

💻

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i lazy-masonry

      Weekly Downloads

      1

      Version

      1.0.1

      License

      ISC

      Unpacked Size

      5.39 kB

      Total Files

      3

      Last publish

      Collaborators

      • rafaelmrdyn