Socket
Socket
Sign inDemoInstall

grid-gallery

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    grid-gallery

un-equal columns grid


Version published
Weekly downloads
6
increased by100%
Maintainers
1
Install size
255 kB
Created
Weekly downloads
 

Readme

Source

JavaScript grid gallery to produce un-equal cols grid

Build Status Coverage Status Dependency Status devDependency Status

Installation:

  1. via npm grid gallery can be used via CommonJS or AMD after installation via npm.

    $ npm install --save grid-gallery
    
  2. bower

    $ bower install --save grid-gallery
    

usage:

the container must have grid-gallery class and the grid items grid-gallery__item

in browser

  <link rel="stylesheet" href="path/to/grid-gallery/dist/css/grid-gallery.min.css">
  ...
  <!-- grid container -->
  <div id="container" class="grid-gallery">
    <!-- grid item -->
    <div class="grid-gallery__item">
      <div>
        <!-- some content -->
      </div>
    </div>

    <!-- grid item -->
    <div class="grid-gallery__item">
      <div>
        <!-- some content -->
      </div>
    </div>
    ....
  </div>

  ...
  <script src="path/to/grid-gallery/dist/js/grid-gallery.js"></script>
CJs
  var GridGallery = require('grid-gallery');
  var options = { ... }

  var myGrid = new GridGallery(document.getElementById('container'), options);
ES6
  import GridGallery from 'grid-gallery';

  var options = { ... }
  var myGrid = new GridGallery(document.getElementById('container'), options);
AMD
    require(['grid-gallery'], (GridGallery) => {
      var options = { ... }
      var myGrid = new GridGallery(document.getElementById('container'), options);
    })

options:

var options = {
  direction: 'right', // left is default for ltr and right for rtl.
  watch: true,        // false by default, and if set to true
                      // it will watch DOM changes
                      // and update positions if grid item inserted/removed

  // callbacks
  onInitialize:  () => { ... }, // called before init.
  onInitialized: () => { ... }, // called after init.
  onUpdate:      () => { ... }, // called before update after 'resize' event as example.
  onUpdated:     () => { ... }, // called after updated.
  onPosition:    () => { ... }, // called before setting position of grid items
  onPositioned:  () => { ... }, // called after positioning the grid items
}

methods

  1. update it will reposition the grid items
  2. destroy it will clear the positions, reset all options and remove event handlers.

Keywords

FAQs

Last updated on 12 May 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc