All Projects → attila → Savvior

attila / Savvior

Licence: mit
A Salvattore and Masonry alternative without CSS-driven configuration or absolute CSS positioning

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Savvior

Framelayoutkit
FrameLayoutKit is a super fast and easy to use autolayout kit
Stars: ✭ 53 (-56.56%)
Mutual labels:  grid-layout
Ordnung
The 1kb alternative to Isotope
Stars: ✭ 79 (-35.25%)
Mutual labels:  masonry
Flutter layout grid
A grid-based layout system for Flutter, inspired by CSS Grid Layout
Stars: ✭ 109 (-10.66%)
Mutual labels:  grid-layout
React Xmasonry
Simple, minimalistic and featured native masonry layout for React JS.
Stars: ✭ 62 (-49.18%)
Mutual labels:  masonry
Interior
Design system for the modern web.
Stars: ✭ 77 (-36.89%)
Mutual labels:  grid-layout
React Rasta
React Rasta is a powerful and flexible grid system for React
Stars: ✭ 88 (-27.87%)
Mutual labels:  grid-layout
Masonry Layout
An efficient and fast web component that gives you a beautiful masonry layout
Stars: ✭ 43 (-64.75%)
Mutual labels:  masonry
Flexlib
FlexLib是一个基于flexbox模型,使用xml文件进行界面布局的框架,融合了web快速布局的能力,让iOS界面开发像写网页一样简单快速
Stars: ✭ 1,569 (+1186.07%)
Mutual labels:  masonry
Vue Masonry Wall
A pure vue responsive masonry layout without direct dom manipulation and ssr support.
Stars: ✭ 79 (-35.25%)
Mutual labels:  masonry
Ngx Masonry
Angular Module for displaying a feed of items in a masonry layout
Stars: ✭ 102 (-16.39%)
Mutual labels:  masonry
Screenadaptationkit
🎨iOS rapidScreen Compatible AdapterKit(Deprecate)
Stars: ✭ 70 (-42.62%)
Mutual labels:  masonry
Personal Goals
List of books I've read, projects I've done, videos I've seen, articles I've read or podcasts I've listened to.
Stars: ✭ 75 (-38.52%)
Mutual labels:  grid-layout
Awesome Grid Layout
👓 A curated list of CSS Grid Layout Module or only Css Grid.
Stars: ✭ 91 (-25.41%)
Mutual labels:  grid-layout
React Native Masonry
🙌 A pure JS react-native component to render a masonry~ish layout for images with support for dynamic columns, progressive image loading, device rotation, on-press handlers, and headers/captions.
Stars: ✭ 1,094 (+796.72%)
Mutual labels:  masonry
Justified Gallery
Javascript library to help creating high quality justified galleries of images. Used by thousands of websites as well as the photography community 500px.
Stars: ✭ 1,512 (+1139.34%)
Mutual labels:  masonry
Burnoutjs
🎮 2D game engine for manage collisions. Made with javascript and CSS Grid Layout.
Stars: ✭ 45 (-63.11%)
Mutual labels:  grid-layout
Grid Cheatsheet
CSS Grid cheat sheet
Stars: ✭ 83 (-31.97%)
Mutual labels:  grid-layout
Bootstrap Grid Css
The grid and responsive utilities classes extracted from the Bootstrap 4 framework, compiled into CSS.
Stars: ✭ 119 (-2.46%)
Mutual labels:  grid-layout
Snack
🍱 A minimal CSS framework for web.
Stars: ✭ 117 (-4.1%)
Mutual labels:  grid-layout
React Photo Layout Editor
Photo layout editor for react
Stars: ✭ 96 (-21.31%)
Mutual labels:  grid-layout

Savvior

Build Status Code Climate Test Coverage

A Javascript solution for multicolumn layouts, an alternative to Salvattore or Masonry, without CSS driven configuration or absolute CSS positioning. A large part of the code is heavily inspired by the excellent Salvattore, however it fixes many of its quirks.

Features

  • Requirements: Savvior depends on on window.matchMedia and enquire.js.
  • Integrates easily: No automatic execution, init the script when YOU think it should happen. For further integration, custom events are dispatched after initialisation or redrawing the layout.
  • Sensible configuration: CSS-driven configuration can make parsing CSS on a CDN troublesome, just pass the element selector instead and a single config object to init() and it's done.
  • Lightweight: ~2.5 kB minified and gzipped
  • Wide browser support: most modern devices/browsers and IE9+

Installation

Install it via npm for your Browserify-based project

npm install savvior

Install it via Bower

bower install savvior

Or just grab the latest release from the Releases page

Usage

Please refer to the Examples for detailed usage information.

Add some CSS

Add some CSS to support the layout when multiple columns are created, e.g

.column { float: left; }
.size-1of2 { width: 50%; }
.size-1of3 { width: 33.33333%; }
.size-1of4 { width: 25%; }

These CSS classes will be added to your columns by default. If you need another classes, you can specify them in options as described in next sections.

Load the JavaScript

CommonJS

In your Browserify projects you can require the module as usual:

var savvior = require('savvior');

using AMD/Require.js

In your configuration:

// Configure paths
requirejs.config({
  paths: {
    enquire: 'path/to/enquire',
    savvior: 'path/to/savvior'
  }
});
```

Then in your project:

```js
require(['savvior', 'domReady!'], function(savvior) {
  // Initialise savvior here.
  //
  // Enquire is a dependency of savvior which should already be loaded by Require
  // You will need to load your own polyfills though.
});

Using a plain script tag

Just add these before your </body>.

<!--[if IE 9]>
<script src="/path/to/media-match.js"></script>
<![endif]-->
<script src="/path/to/enquire.min.js"></script>
<script src="/path/to/savvior.min.js"></script>

Initialise

  savvior.init("#myGrid", {
    "screen and (max-width: 20em)": { columns: 2 },
    "screen and (min-width: 20em) and (max-width: 40em)": { columns: 3 },
    "screen and (min-width: 40em)": { columns: 4 },
  });

Grid items can be excluded by using filter in the options. This takes a string consumable by document.querySelectorAll(). This is processed in each mediaMatch breakpoint, examples:

  savvior.init("#myGrid", {
    "screen and (max-width: 20em)": {
      columns: 2,
      filter: '#excludeme'
    },
    "screen and (min-width: 20em) and (max-width: 40em)": {
      columns: 3,
      filter: '#excludeme, .filter-these-as-well'
    },
    "screen and (min-width: 40em)": { columns: 4 },
  });

Also, you can specify which CSS classes will be applied to columns on each media query, examples:

  savvior.init("#myGrid", {
    "screen and (max-width: 20em)": {
      columns: 2,
      columnClasses: 'mobile-columns mobile-columns-one-half' // as a string
    },
    "screen and (min-width: 20em) and (max-width: 40em)": {
      columns: 3,
      columnClasses: ['tablet-columns', 'tablet-columns-1-3'] // as an array
    },
    "screen and (min-width: 40em)": { columns: 4 }, // default classes "column size-1of4"
  });

Get status

  savvior.ready();
  // returns ["#myGrid"]
  savvior.ready("#myGrid");
  // returns true

Destroy

  // destroy all instances
  savvior.destroy();
  // destroy specific instances
  savvior.destroy(["#myGrid", "#anotherGrid"]);

Add elements to a grid

  // Set some options, defaults are:
  var options = {
    method: 'append' // One of 'append', or 'prepend'.
    clone: false // Whether to clone elements or move them.
  };
  var someItems = document.querySelectorAll('.new-items');
  savvior.addItems('#myGrid', someItems, options, function (grid) {
    // All done by now.
    console.log(grid);
  });

History of changes

See CHANGELOG

Contributing

If you find an bug or a problem please open an issue.

This project uses Grunt for running the builds and tests. The module uses an UMD wrapper to retain compatibility with CommonJS and AMD module formats. Tests are run via Jasmine in PhantomJS.

Install the development environment

To install the development dependencies, make sure you have nodejs installed, then:

  1. Install grunt-cli with npm i grunt-cli -g
  2. Install development dependencies with npm i
  3. Build the project by running grunt

Pull requests for new features or bug fixes are most welcome, just make sure it conforms the current coding style of the project.

Development

Project led and maintained by Attila Beregszaszi

Development sponsored by Dennis Publishing and Front Seed Labs

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].