• This repository has been archived on 30/Dec/2018
  • Stars
    star
    1,118
  • Rank 39,988 (Top 0.9 %)
  • Language
    CoffeeScript
  • License
    MIT License
  • Created almost 11 years ago
  • Updated almost 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An AngularJS directive for Masonry.

AngularJS Masonry Directive Build StatusDependency Status Code Climate

Homepage

An AngularJS 1 directive to work with David Desandro's Masonry.

Usage

  1. Install via either bower or npm:

    1. bower install --save angular-masonry
    2. npm install --save angular-masonry
  2. Add wu.masonry to your application's module dependencies.

  3. Include dependencies in your HTML.

    <script src="bower_components/ev-emitter/ev-emitter.js"></script>
    <script src="bower_components/desandro-matches-selector/matches-selector.js"></script>
    <script src="bower_components/fizzy-ui-utils/utils.js"></script>
    <script src="bower_components/get-size/get-size.js"></script>
    <script src="bower_components/outlayer/item.js"></script>
    <script src="bower_components/outlayer/outlayer.js"></script>
    <script src="bower_components/masonry/masonry.js"></script>
    
    <!-- optional -->
    <script src="bower_components/imagesloaded/imagesloaded.js"></script>
    <!-- /optional -->
    
    <script src="bower_components/angular/angular.js"></script>
    <script src="bower_components/angular-masonry/angular-masonry.js"></script>
  4. Use the masonry directive.

Example

See the homepage for a live example.

<div masonry load-images="true">
    <div class="masonry-brick" ng-repeat="brick in bricks">
        <img ng-src="{{ brick.src }}" alt="A masonry brick">
    </div>
</div>

You have to include the masonry attribute on the element holding the bricks. The bricks are registered at the directive through the masonry-brick CSS classname.

The directive optionally uses imagesloaded to determine when all images within the masonry-brick have been loaded and adds the loaded CSS class to the element, so you can add custom styles and prevent ghosting effects.

Attributes

item-selector

(Default: .masonry-brick)

You can specify a different item selector through the item-selector attribute. You still need to use masonry-brick either as class name or element attribute on sub-elements in order to register it to the directive.

Example:

<masonry item-selector=".mybrick">
    <div masonry-brick class="mybrick">Unicorns</div>
    <div masonry-brick class="mybrick">Sparkles</div>
</masonry>

column-width

The column-width attribute allows you to override the the width of a column of a horizontal grid. If not set, Masonry will use the outer width of the first element.

Example:

<masonry column-width="200">
    <div class="masonry-brick">This will be 200px wide max.</div>
</masonry>

preserve-order

The preserve-order attributes disables the imagesLoaded logic and will instead display bricks by the order in the DOM instead of by the time they are loaded. Be aware that this can lead to visual glitches if the size of the elements isn't set at the time they are inserted.

Example:

<masonry preserve-order>
    <div class="masonry-brick"><img src="..." alt="Will always be shown 1st"></div>
    <div class="masonry-brick"><img src="..." alt="Will always be shown 2nd"></div>
</masonry>

load-images

Allows usage of imagesLoaded plugin. Defaults to false.

Example:

<masonry load-images="true">
    <div class="masonry-brick"><img src="/your/image_1.jpg" alt="image"/></div>
    <div class="masonry-brick"><img src="/your/image_2.jpg" alt="image"/></div>
</masonry>

reload-on-show

The reload-on-show attribute triggers a reload when the masonry element (or an ancestor element) is shown after being hidden, useful when using ng-show or ng-hide. Without this if the viewport is resized while the masonry element is hidden it may not render properly when shown again.

Example:

<masonry reload-on-show ng-show="showList">
    <div class="masonry-brick">...</div>
    <div class="masonry-brick">...</div>
</masonry>

When showList changes from falsey to truthy ctrl.reload will be called.

reload-on-resize

The reload-on-resize attribute triggers a reload when the masonry element changes its width, useful when only the parent element is resized (and not the window) and you want the elements to be rearranged. Without this if the parent is resized then some blank space may be left on the sides.

Example:

<masonry reload-on-resize>
    <div class="masonry-brick">...</div>
    <div class="masonry-brick">...</div>
</masonry>

masonry-options

You can provide additional options as expression either as masonry or masonry-options attribute.

Example:

<masonry masonry-options="{ transitionDuration: '0.4s' }">
</masonry>

Equivalent to:

<div masonry="{ transitionDuration: '0.4s' }">
</div>

prepend

Bricks are appended by default. This behavior can be specified for each brick by providing the prepend attribute.

Example:

<div masonry>
    <div class="masonry-brick" prepend="isPrepended()">...</div>
</div>

Credits

The directive is based on a StackOverflow question answered by James Sharp.

Contributing

Please refer to CONTRIBUTING.md before opening issues or pull requests.

License

MIT

Bitdeli Badge

More Repositories

1

build-time-tracker-plugin

Gradle plugin to continuously track and report your build times
Groovy
1,203
star
2

awesome-recursion-schemes

Resources for learning and using recursion schemes.
1,183
star
3

Android-DirectoryChooser

A directory chooser library for Android.
Java
514
star
4

awesome-purescript

A curation of awesome PureScript libraries, resources and shiny things.
447
star
5

scdl

Soundcloud Downloader App for Android
Java
301
star
6

givegif

GIFs on the command line
Haskell
220
star
7

autoprefixer-loader

Webpack loader for autoprefixer
JavaScript
217
star
8

android-lint-summary

Prettier display of Android Lint issues
Haskell
178
star
9

x-pokemon

A web component to display Pokémon.
HTML
89
star
10

google-cdn

Replaces references to resources on the Google CDN
JavaScript
70
star
11

react-pokemon

A React component for displaying Pokémon
HTML
58
star
12

generator-heroku

A Heroku config generator for Yeoman
JavaScript
45
star
13

angular-google-staticmaps

An AngularJS directive to quickly insert Google Static Maps.
CoffeeScript
38
star
14

raspbian-vpn-router

Setting up a Raspberry Pi 3 as a VPN Gateway
Shell
33
star
15

generator-bookmarklet

Yeoman Generator for Bookmarklets
JavaScript
33
star
16

ama

Ask Me Anything
33
star
17

flask-gae-mini-profiler

Flask extension for easy profiling on Google App Engine
Python
33
star
18

elm-pokemon

Elm
28
star
19

giphy-api

Giphy HTTP API Wrapper for Haskell
Haskell
27
star
20

ctlmngr

A manager for custom timelines
JavaScript
21
star
21

ltxbot

A Twitter bot that renders LaTeX for you
Haskell
21
star
22

sindrebday

Sindre has circled around the sun once more
HTML
18
star
23

rss-markdown-proxy

A reverse proxy for rendering Markdown within RSS feeds
Haskell
18
star
24

nose-notify

Desktop notifications via notify-osd for nose tests
Python
16
star
25

coding-puzzles

Some public coding puzzles
Haskell
15
star
26

node-dom-urls

A partial implementation of the W3C URL Spec Draft for Node
JavaScript
15
star
27

purescript-errors

Handy error handling combinators for PureScript
PureScript
15
star
28

tweetdock

An experiment architecting something like TweetDeck with Flight.
JavaScript
15
star
29

revmenu

Navigate to git/hg revisions in your terminal using your keyboard.
Rust
12
star
30

cows-hs

ASCII 🐮s
Haskell
12
star
31

latest-npm-version

Get the latest version of a package on npm
Haskell
12
star
32

attic-schedule

A Turtle script I use to kick off attic
Haskell
11
star
33

Horse.hs

Tweet like a Horse
Haskell
10
star
34

podserve

Serve a podcast feed from a directory with MP3s in it.
Rust
10
star
35

passy.me

My homepage
JavaScript
10
star
36

financius-notebook

An IPython Notebook I use to crunch my Financius data
Jupyter Notebook
8
star
37

nose-lettuce

A probably bad idea of how to run lettuce from nose
Python
8
star
38

blog

Articles I've written
7
star
39

Android-ViewPagerIndicator-AAR

AAR fork of Jake Wharton's ViewPagerIndicator
Java
7
star
40

firebase-functions-webpack-example

Firebase Cloud Functions + TypeScript + PureScript + Webpack
JavaScript
7
star
41

purescript-simple-moment

A minimal PureScript wrapper around moment.js
PureScript
7
star
42

hls-proxy

A reverse HTTP proxy that may eventually do things
Haskell
6
star
43

optparse-text

Helpers for optparse-applicative to deal with Data.Text
Haskell
6
star
44

flight-knockout

Easy data-bindings in Flight with Knockout
JavaScript
6
star
45

rust-tracerayer

A toy ray tracer in Rust.
Rust
6
star
46

twentiment

Research project on sentiment analysis using the Naïve Bayes Classificator
Python
6
star
47

absshadow-sample

Sample Android project showing how to test ActionBarSherlock with Robolectric
Java
6
star
48

Android-LintSummarySample

Example of how to use android-lint-summary with gradle
Java
6
star
49

collab-counter

A distributed, eventually consistent counter with magical powers
Elm
5
star
50

backbone.datalink

Wrapper around Synapse for easy data binding between models and views.
CoffeeScript
5
star
51

tube-roundel

Web service for rendering TfL Tube roundels.
Haskell
5
star
52

tweetproxy

An authenticated Twitter API proxy in Haskell. (WIP)
Haskell
5
star
53

twoxpy

A super limited Twitter API OAuth signing proxy
Python
5
star
54

glashammer-rdrei

Fork of Glashammer adding some custom patches
Python
5
star
55

simstatus

Android Application to check for the Sim City Server Status
Java
5
star
56

r3bb

A (really) tiny jQuery based WYSIWYG editor that outputs bbcode
JavaScript
4
star
57

soccer-stats-backend

Backend for my soccer prediction app doing some calculations with NumPy
Python
4
star
58

raspbian-home-server

Shell
4
star
59

todomvc-purescript-react

Nothing to see here, move along!
PureScript
4
star
60

angular-dart-todomvc

Work in progress
Dart
4
star
61

rdreiflask

My old flask-based homepage. No longer under development or in use.
JavaScript
4
star
62

OfflineArticles

[WIP] Offline reading app for Android
HTML
4
star
63

giflib

A PureScript experiment that is supposed to be a personal gif library
PureScript
4
star
64

raspbian-ipv6-router

A Raspberry Pi config to use it as DHCP/RA server
Shell
4
star
65

tube-trains-bot

A Google Home action allowing you to ask for TfL Tube departures.
Haskell
4
star
66

peano

Basic Peano numbers in Haskell
Haskell
4
star
67

playground

Everyone likes to play.
HTML
4
star
68

carbon-intensity-bot

A Google Home bot to enquire about your local electricity's carbon intensity.
TypeScript
4
star
69

simpledownloader

Playground for mono and gtk#
C#
3
star
70

html-oust

[WIP] Extract paths of stylesheets, scripts and HTML imports from HTML files
Haskell
3
star
71

mobile-restaurants

Mobile website prototypes for restaurants build with AngularJS and Yeoman.
JavaScript
3
star
72

dotvim

My neovim configuration
Vim Script
3
star
73

rdreilib

Various reusable utilities for Glashammer/WSGI projects. BSD-licensed.
Python
3
star
74

ics-notebook

A Jupyter notebook for analyzing iCalendar files
Jupyter Notebook
3
star
75

bouncyball

OpenGL bouncing ball with Yampa, GLUT
Haskell
3
star
76

mycdb

Learning project re-implementing a client to read constant databases (CDBs)
C
3
star
77

wakivote

WAKiVote
JavaScript
3
star
78

tube-bot

Messenger bot frontend for the Tube disruption tracker
PureScript
2
star
79

ordered-jobs-kata-rust

Ordered Jobs Kata in Rust
Rust
2
star
80

ConnectivityAlert

Dagger 2 + Android playground
Java
2
star
81

lens-over-tea

Haskell
2
star
82

flight-view-demos

Experiments for combining FlightJS with 2-way data binding libraries
JavaScript
2
star
83

canjs-localstorage

Bower repository of the localStorage plugin for CanJS
JavaScript
2
star
84

java-repl

java-repl for docker
2
star
85

disruption-tracker

Tracking Tube disruptions and write them to a RethinkDB
Haskell
2
star
86

financius2bluecoins

A script to migrate Financius transactions to Bluecoins
Haskell
2
star
87

soccer-stats-frontend

AngularJS-based frontend doing some soccer predictions based on simple time-independent least square regression.
CSS
2
star
88

gymahz_scripts

Scripts for the daily use at the Gymnasium Altenholz
Python
2
star
89

twime

Twitter bot in Scala
Scala
2
star
90

fakemvc

Experimenting with TodoMVC
JavaScript
2
star
91

Android-AdapterMergeExample

Android example for merging multiple adapters for one autocomplete field
Java
2
star
92

gbridge-bridge

Relay gbridge.io events to another MQTT broker. Part of my home IoT setup, but unlikely of any use to anybody else.
Rust
2
star
93

TrieSuggest

Toy program in Haskell using tries to implement some autocompletion stuff
Haskell
2
star
94

WAKiMail

Android mail client for WAK students (www.wak-sh.de)
Java
1
star
95

displaypower

Fun project enabling DPMS when gnome-screensaver turns on
C
1
star
96

photo-share

An Effective Kotlin Android App experiment
Java
1
star
97

twentiment-api

A REST-ish API for twentiment
Python
1
star
98

fun-hs

My attempt to implement @sdiehl's fun language.
Haskell
1
star
99

angularjs-bcki-slides

German slides for my AngularJS session at Barcamp Kiel 2012
JavaScript
1
star
100

level8

My script for cracking Level 8 of the Stripe-CTF challenge
Python
1
star