Coder Social home page Coder Social logo

gridion's Introduction

Gridion v0.0.3

A small self-adjusting js grid.

Install via npm:

npm i gridion --save

js

import Gridion from 'gridion';
import 'gridion/dist/gridion.css';
let grid = new Gridion('.container',6);

Or use cdn:

<link rel="stylesheet" href="https://cdn.rawgit.com/rizerok/Gridion/v0.0.3/dist/gridion.css">
<script src="https://cdn.rawgit.com/rizerok/Gridion/v0.0.3/dist/gridion.js"></script>
let grid = new Gridion('.container',6);

Demo:

Simple demo

Demo1

Demo2 (Infinity gallery)

Usage:

let grid = new Gridion(parentSelector,cols);

parentSelector - tag selector that contains grid;

cols - columns amount;

let cellConfig = {
	size:{
		w:1,//width
		h:2//height
	},
	data:'content'//content,
    buildCallback:function(){
        //running callback when cell is added to model
    }
}

//just an array of cell configurations
let configList = [
    cellConfig1,
    cellConfig2,
];

grid.addItems(configList,index,cbk) - Adds cells to grid

grid.removeItem(id,cbk) - Remove cell from grid

grid.scaleItem(id,x,y,cbk) - Change cell size

grid.fastAddItem(config,index) - Adds cell to grid, without animation

grid.fastAddItems(configList,index) - Adds cells to grid, without animation

grid.fastRemoveItem(id) - Remove cell from grid, without animation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.