Skip to content

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

Notifications You must be signed in to change notification settings

midblue/FreeMase

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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()

About

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

Resources

Stars

Watchers

Forks