1.0.4 • Published 3 years ago

freemase v1.0.4

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

FreeMase

A lightweight and fast masonry layout generator that supports fully variable element sizes.

  • Tightly packs HTML elements of any size and shape
  • Zero dependencies
  • Written in Typescript
  • Automatically updates on element addition, removal, or resize

Example

Install

npm install freemase

Simple Usage

import FreeMase from 'freemase'
const parentElement = document.queryElementById('parent')
const fm = new FreeMase(parentElement)

With Options

const options = {
  centerX: false, // Horizontally center elements in container. Default: false.
  verbose: false, // Show debugging logs. Default: false.
}

import FreeMase from 'freemase'
const parentElement = document.queryElementById('parent')
const fm = new FreeMase(parentElement, options)

Add transiton animation and/or fade-in on element addition

#parent > * {
  transition: top 1s, left 1s, opacity 1s;
  opacity: 0;
}

Manually call reposition (should be unnecessary)

fm.position()
1.0.2

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago