Giter Club home page Giter Club logo

minimasonry.js's Introduction

MiniMasonry.js

Minimalist dependancy free Masonry layout library

MiniMasonry is a lightweight (1kb Gzipped) dependancy free Masonry layout. It will compute elements position in Javascript and update their positions using css's transform attribute. This means positioning does not trigger browser layout and use the device's GPU. This also allow css animation during element positionning.

MiniMasonry is responsive, you give it a target width and it will adjust columns number and elements width. MiniMasonry will increase element width (until another column can fit in the layout) but will never reduce the target width.

Installation

Just include the minified version of MiniMasonry.js on your website :

<script src="minimasonry/build/minimasonry.min.js"></script>

Usage

To use MiniMasonry you should have a container relatively positioned with your elements as children. Those children elements must be absolutely positioned.

Then you can initialise MiniMasonry :

var masonry = new MiniMasonry({
    container: '.masonry_transition'
});

Parameters

Here is the list of available parameters :

Name Default value Description
baseWidth 255 Target width of elements.
container Null Container selector. Required
gutter 10 Width / height of gutter between elements/
minify true Whether or not MiniMasonry place elements on shortest column or keep exact order of list.

API

Here is the list of available APIs :

Name Description
layout() If list has changed, trigger a relayout of the masonry

MiniMasonry will add a "resize" event listener on the window to redraw the masonry on window resize. This listener is throttled to 66ms (15fps).

Example

See website

License

MIT

Made by Spope

minimasonry.js's People

Contributors

spope avatar

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.