Giter VIP home page Giter VIP logo

angular-bricklayer's Introduction

angular-bricklayer

AngularJS module for ademilter's bricklayer, a lightweight & independent cascading grid layout library

npm version Bower version

Demos

Image

Installation

  1. Install via either bower, npm or downloaded files:

    1. via bower: bower install --save angular-bricklayer
    2. via npm: npm install --save angular-bricklayer
    3. via CDN (jsDelivr)
    4. via downloaded files
  2. Include dependencies and angular-bricklayer in your HTML.

    1. When using bower
    <link rel="stylesheet" href="bower_components/bricklayer/dist/bricklayer.min.css">
    <script src="bower_components/bricklayer/dist/bricklayer.min.js"></script>
    <script src="bower_components/angular-bricklayer/dist/angular-bricklayer.min.js"></script>
    1. When using npm
    <link rel="stylesheet" href="node_modules/bricklayer/dist/bricklayer.min.css">
    <script src="node_modules/bricklayer/dist/bricklayer.min.js"></script>
    <script src="node_modules/angular-bricklayer/dist/angular-bricklayer.min.js"></script>
    1. When using CDN
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/bricklayer/0.4.3/bricklayer.min.css">
    <script src="//cdnjs.cloudflare.com/ajax/libs/bricklayer/0.4.3/bricklayer.min.js"></script>
    <script src="//cdn.jsdelivr.net/npm/[email protected]/dist/angular-bricklayer.min.js"></script>
    1. When using downloaded files
    <link rel="stylesheet" href="YOUR_PATH/bricklayer.min.css">
    <script src="YOUR_PATH/bricklayer.min.js"></script>
    <script src="YOUR_PATH/angular-bricklayer.min.js"></script>
  3. Add jtt_bricklayer to your application's module dependencies, like this:

    angular.module('app', ['jtt_bricklayer']);

Usage

Create a simple list and set the css class bricklayer like this

<div class="bricklayer" ng-cloak>
    <div>Your item</div>
    <div>Your another item</div>
    <div>Your another but long item</div>
    <div>Your another but very short item</div>
    <div>Your one more item</div>
    <div>Your smallest item</div>
</div>

Define bricklayer column size:

@media screen and (min-width: 1200px) {
  .bricklayer-column-sizer {
    /* divide by 3. */
    width: 33.3%;
  }
}

@media screen and (min-width: 768px) {
  .bricklayer-column-sizer {
    /* divide by 2. */
    width: 50%;
  }
}

Add bricks dynamically

Use bricklayer-append or bricklayer-prepend as attribute, class or element name inside of your bricklayer instance

<div class="bricklayer" ng-cloak>
    <!-- append -->
    <div bricklayer-append ng-repeat="item in appendData" ng-cloak></div>

    <!-- prepend -->
    <div bricklayer-prepend ng-repeat="item in prependData" ng-cloak></div>
</div>

Images

Since v1.1.0 the grid gets redrawn when images have been loaded, by including and using desandro's imagesloaded

License

MIT

angular-bricklayer's People

Contributors

johnnythetank avatar lukasdrgon avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

angular-bricklayer's Issues

Duplicate value on update for the array on scope.

Hi,

If I updated the appendData in the $scope with a new array values, it won't update correctly the array and the items get always append to the array. In my case the array get updated every 30seg. So it will always present new duplicate values.

<div class="bricklayer" ng-cloak>
    <!-- append -->
    <div bricklayer-append ng-repeat="item in appendData" ng-cloak></div>

    <!-- prepend -->
    <div bricklayer-prepend ng-repeat="item in prependData" ng-cloak></div>
</div>

Doesn't seem to work when filters applied to ngRepeat

Here's an example of what I'm trying to do:

<input type="text" ng-model="vm.filterTags" />
<div class="bricklayer" ng-cloak>
    <div bricklayer-append ng-repeat="image in vm.images | filter:{tags:vm.filterTags}" ng-cloak>
		<img src="....." style="max-width:100%;" />
	</div>
</div>
vm.images = [
			{ filename: "1.jpg", tags: "nature" },
			{ filename: "2.jpg", tags: "ball" },
			{ filename: "3.jpg", tags: "car" }
	   ];

Delete element, and multiple bricklaer on same page.

I was working in this issue on my "own" version of this plugin (Just rewrote in my application style), and with this slight changes you can:

  • Have multiple bricklayer on same page
  • Remove elements without trouble.

This is a gist with the plugin code https://gist.github.com/epicleptico/27e6e8e444d11d0aa4686f112ea7964f (As you must see i have application specific code style).

You can take a look on working plunkr on https://plnkr.co/edit/3NmNUIfACo6Yb8qCniZb (Use full screen preview)

Just to note, for multiple versions you must place id and data-target on main div and child divs. And for delete you must place inside a $timeout a $broadcast with removing data.

Hope that helps. Thanks

imagesLoaded packaged inside

I have imagesLoaded library used on my project and when tried your plugin i reach the trouble that is loaded twice.

Just split it and add imagesLoaded as dependency.

How to redraw?

HI,

I am having bricklayer grid in tab. In my case I am able see the images but only one column and 100% width when I resize the browser I am able to see 4 column grid(desktop default view). In this case how to redraw the grid?

Please find attached Plunk http://plnkr.co/edit/5i4wrO0UvHCICxp3R6rg?p=preview
Bricklayer grid is in second tab. by default nothing is visible if you resize the grid everything shows up.

Thanks

Clear array

When using bricklayer-append on ng-repeat's result, how to clear the array on click? When trying to empty the array on click, this directive keeps adding the new result to the old array.

issue loading 237 items

Hi,

I am trying to load 237 items with this components but the browser simple don't response. Then I had to remove JS the code from the page.

It is working fine If I just load two items.

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.