GithubHelp home page GithubHelp logo

hekima / angular-masonry Goto Github PK

View Code? Open in Web Editor NEW

This project forked from passy/angular-masonry

0.0 12.0 0.0 546 KB

An AngularJS directive for Masonry.

Home Page: http://passy.github.io/angular-masonry

License: MIT License

JavaScript 68.64% CoffeeScript 31.36%

angular-masonry's Introduction

Angular Masonry Directive Build Status Dependency Status

Homepage

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

Usage

  1. bower install --save angular-masonry
  2. Include dependencies in your HTML.
  3. Use the masonry directive.

Example

See the homepage for a live example.

<div masonry>
    <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 uses imagesloaded to determine when all images within the masonry-brick have been loaded and adds the loaded CSS class to 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>

masonry-options

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

Example:

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

Equivalent to:

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

Credits

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

Contributing

Pull requests welcome. Only change files in src and don't bump any versions. Please respect the code style in place.

License

MIT

angular-masonry's People

Contributors

danielepiccone avatar jonanh avatar nicolai86 avatar passy avatar phuwanart avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.