0.6.0 • Published 2 years ago

gridder-js v0.6.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

GridderJS

⚠ WARNING: This plugin is in heavy development, use with caution!

A JS plugin that displays a thumbnail grid expanding preview similar to the effect seen on Google Images.

We have all searched images on Google, so you probably noticed the interesting expanding preview when you click on a thumbnail. It’s a very nice effect and practical, allowing you quickly see more details without having to reload a new page. This plugin allows you to recreate a similar effect on a thumbnail grid. The idea is to open a preview when clicking on a thumbnail and to show a larger image and some other content like a title, a description and a link


Features

  • Multiple instances
  • Really easy to use and customize with CSS & HTML
  • Expanding preview with static content or dynamic (fetch) content
  • Smooth Scrolling
  • Old / new google images display (expander underneath grid or as a sidebard on the right hand side)
  • Lightweight (10kb gzipped)

Options


Quickstart

Install:

$ npm install --save gridder-js
# or with yarn:
$ yarn add gridder-js

Use as ES6 module (recommended):

import { GridderJS } from "gridder-js";
const gridder = new GridderJS("div#myId", {
    columns: 4,
    gap: 15
  });

or use as CommonJS module:

const { GridderJS } = require("gridder-js");
const gridder = new GridderJS("div#myId", {
    columns: 4,
    gap: 15
  });

Not using a package manager or bundler?:

<script src="https://unpkg.com/gridder-js@latest/dist/gridder-js-min.js"></script>
  1. HTML

    <!-- Gridder navigation -->
    <div class="gridder" id="myId">
      <div class="gridder-list">
       <!-- You can load specify which content is loaded by specifying the #ID of the div where the content is  -->
       <div data-target="content1"></div>
       <div data-target="content2"></div>
       <div data-target="content3"></div>
       <div data-target="content4"></div>
       <div data-target="content5"></div>
       <div data-target="content6"></div>
    
       <!-- You can specify data-url to load ajax content using fetch -->
       <div :data-url="'content.html'"></div>
      </div>
    </div>
    
    <!-- Gridder content -->
    <div id="content1" style="display:none"> Content 1 goes here... </div>
    <div id="content2" style="display:none"> Content 2 goes here... </div>
    <div id="content3" style="display:none"> Content 3 goes here... </div>
    <div id="content4" style="display:none"> Content 4 goes here... </div>
    <div id="content5" style="display:none"> Content 5 goes here... </div>
    <div id="content6" style="display:none"> Content 6 goes here... </div>
  2. Call the plugin:

    <script>
    	// Instantiate the plugin
      new GridderJS('.gridder', {
        columns: 4,
        gap: 15
      });
    </script>

This work is licensed under a Creative Commons Attribution 3.0 Unported License.

0.6.0

2 years ago

0.5.9

2 years ago

0.5.8

2 years ago

0.5.7

2 years ago

0.5.5

2 years ago