JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 48
  • Score
    100M100P100Q64018F
  • License MIT

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

Package Exports

  • gridder-js
  • gridder-js/dist/gridder-js.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (gridder-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

GridderJS

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
  • Expanding preview with details
  • Smooth Scrolling
  • Static Content / Dynamic (Fetch) Content

ROADMAP

  • add mobile responsive css / js (not sure how to do that yet)
  • lazy loading images in expanded content
  • themes

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", { url: "/file/post" });

or use as CommonJS module:

const { GridderJS } = require("gridder-js");
const gridder = new GridderJS("div#myId", { url: "/file/post" });

Not using a package manager or bundler?:

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

Usage

  1. HTML

    <!-- Gridder navigation -->
    <div class="gridder">
    
       <!-- You can load specify which content is loaded by specifying the #ID of the div where the content is  -->
       <div class="gridder-list" data-target="content1"></div>
       <div class="gridder-list" data-target="content2"></div>
       <div class="gridder-list" data-target="content3"></div>
       <div class="gridder-list" data-target="content4"></div>
       <div class="gridder-list" data-target="content5"></div>
       <div class="gridder-list" data-target="content6"></div>
    
       <!-- You can specify data-url to load ajax content using fetch -->
       <div class="gridder-list" :data-url="'content.html'"></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,
        nextText: "Next",
        prevText: "Previous",
        closeText: "Close",  
        init: function(){ console.log('onStart callback'); },
        open: function(){ console.log('onOpen callback'); },
        close: function(){ console.log('onClose callback'); },
      });
    </script>

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