outlayer

WebJar for outlayer

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

outlayer
Last Version

Last Version

2.1.1
Release Date

Release Date

Type

Type

jar
Description

Description

outlayer
WebJar for outlayer
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/metafizzy/outlayer

Download outlayer

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/outlayer/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>outlayer</artifactId>
    <version>2.1.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/outlayer/
implementation 'org.webjars.npm:outlayer:2.1.1'
// https://jarcasting.com/artifacts/org.webjars.npm/outlayer/
implementation ("org.webjars.npm:outlayer:2.1.1")
'org.webjars.npm:outlayer:jar:2.1.1'
<dependency org="org.webjars.npm" name="outlayer" rev="2.1.1">
  <artifact name="outlayer" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='outlayer', version='2.1.1')
)
libraryDependencies += "org.webjars.npm" % "outlayer" % "2.1.1"
[org.webjars.npm/outlayer "2.1.1"]

Dependencies

compile (3)

Group / Artifact Type Version
org.webjars.npm : ev-emitter jar [1.0.0,2)
org.webjars.npm : get-size jar [2.0.2,3)
org.webjars.npm : fizzy-ui-utils jar [2.0.0,3)

Project Modules

There are no modules declared in this project.

Outlayer

Brains and guts of a layout library

Outlayer is a base layout class for layout libraries like Isotope, Packery, and Masonry

Outlayer layouts work with a container element and children item elements.

<div class="grid">
  <div class="item"></div>
  <div class="item"></div>
  <div class="item"></div>
  ...
</div>

Install

Install with Bower: bower install outlayer

Install with npm: npm install outlayer

Outlayer.create()

Create a layout class with Outlayer.create()

var Layout = Outlayer.create( namespace );
// for example
var Masonry = Outlayer.create('masonry');
  • namespace {String} should be camelCased
  • returns LayoutClass {Function}

Create a new layout class. namespace is used for jQuery plugin, and for declarative initialization.

The Layout inherits from Outlayer.prototype.

var elem = document.querySelector('.selector');
var msnry = new Masonry( elem, {
  // set options...
  columnWidth: 200
});

Item

Layouts work with Items, accessible as Layout.Item. See Item API.

Declarative

An Outlayer layout class can be initialized via HTML, by setting an attribute of data-namespace on the element. Options are set in JSON. For example:

<!-- var Masonry = Outlayer.create('masonry') -->
<div class="grid" data-masonry='{ "itemSelector": ".item", "columnWidth": 200 }'>
  ...
</div>

The declarative attributes and class will be dashed. i.e. Outlayer.create('myNiceLayout') will use data-my-nice-layout as the attribute.

.data()

Get a layout instance from an element.

var myMasonry = Masonry.data( document.querySelector('.grid') );

jQuery plugin

The layout class also works as jQuery plugin.

// create Masonry layout class, namespace will be the jQuery method
var Masonry = Outlayer.create('masonry');
// rock some jQuery
$( function() {
  // .masonry() to initialize
  var $grid = $('.grid').masonry({
    // options...
  });
  // methods are available by passing a string as first parameter
  $grid.masonry( 'reveal', elems );
});

RequireJS

To use Outlayer with RequireJS, you'll need to set some config.

Set baseUrl to bower_components and set a path config for all your application code.

requirejs.config({
  baseUrl: 'bower_components',
  paths: {
    app: '../'
  }
});

requirejs( [ 'outlayer/outlayer', 'app/my-component.js' ], function( Outlayer, myComp ) {
  new Outlayer( /*...*/ )
});

Or set a path config for all Outlayer dependencies.

requirejs.config({
  paths: {
    'ev-emitter': 'bower_components/ev-emitter',
    'get-size': 'bower_components/get-size',
    'desandro-matches-selector': 'bower_components/desandro-matches-selector'
  }
});

MIT license

Outlayer is released under the MIT license.

org.webjars.npm

Metafizzy

Delightful JS plugins

Versions

Version
2.1.1
2.1.0
2.0.0
1.4.2