forked from passy/angular-masonry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
127 lines (113 loc) · 5.27 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>AngularJS Masonry Directive</title>
<link href="//netdna.bootstrapcdn.com/bootswatch/2.3.2/united/bootstrap.min.css" rel="stylesheet">
<style>
body {
margin-top: 1em;
}
.masonry-brick {
margin: 1em;
display: none;
}
.masonry-brick.loaded {
display: block;
}
</style>
</head>
<body class="container" ng-app="masonryApp">
<div class="hero-unit">
<h1>angular-masonry</h1>
<p>A directive to use masonry with AngularJS.</p>
<iframe
src="http://ghbtns.com/github-btn.html?user=passy&repo=angular-masonry&type=watch&size=large&count=true"
allowtransparency="true" frameborder="0" scrolling="0" width="170" height="30"></iframe>
<iframe
src="http://ghbtns.com/github-btn.html?user=passy&repo=angular-masonry&type=fork&size=large&count=true"
allowtransparency="true" frameborder="0" scrolling="0" width="170" height="30"></iframe>
<iframe
src="http://ghbtns.com/github-btn.html?user=passy&repo=angular-masonry&type=follow&size=large&count=true"
allowtransparency="true" frameborder="0" scrolling="0" width="170" height="30"></iframe>
</div>
<div class="row">
<div class="span12">
<h2>Getting Started</h2>
<ol>
<li>Install with bower: <code>bower install --save
angular-masonry</code></li>
<li>Include <code>angular-masonry.js</code>.</li>
<li>Add <code>wu.masonry</code> to you app modules.</li>
<li>Use the <code>masonry</code> directive.</li>
</ol>
If you hate proper package management, you can also
directly download
<a href="./angular-masonry.js">angular-masonry.js</a> or
<a href="./angular-masonry.min.js">angular-masonry.min.js</a>.
</div>
</div>
<hr>
<div class="row" ng-controller="DemoCtrl">
<div class="span12">
<h2>In Action</h2>
<div class="btn-group">
<button class="btn btn-primary" ng-click="add()">Add</button>
<button class="btn btn-danger" ng-click="remove()">Remove</button>
</div>
<div masonry>
<div class="masonry-brick" ng-repeat="brick in bricks">
<img ng-src="{{ brick.src }}" alt="A masonry brick">
</div>
</div>
<h2>Code</h2>
<pre ng-non-bindable><div <strong>masonry</strong>>
<div <strong>class="masonry-brick"</strong> ng-repeat="brick in bricks">
<img ng-src="{{ brick.src }}" alt="A masonry brick">
</div>
</div></pre>
</div>
</div>
<a href="https://github.com/passy/angular-masonry"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_orange_ff7600.png" alt="Fork me on GitHub"></a>
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/jquery-bridget/jquery-bridget.js"></script>
<script src="bower_components/get-size/get-size.js"></script>
<script src="bower_components/ev-emitter/ev-emitter.js"></script>
<script src="bower_components/matches-selector/matches-selector.js"></script>
<script src="bower_components/fizzy-ui-utils/utils.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>
<script src="bower_components/imagesloaded/imagesloaded.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular.min.js"></script>
<script src="angular-masonry.js"></script>
<script>
angular.module('masonryApp', ['wu.masonry']).
controller('DemoCtrl', function ($scope) {
function genBrick() {
var height = ~~(Math.random() * 500) + 100;
var id = ~~(Math.random() * 10000);
return {
src: 'http://lorempixel.com/g/280/' + height + '/?' + id
};
};
$scope.bricks = [
genBrick(),
genBrick(),
genBrick(),
genBrick(),
genBrick()
];
$scope.add = function add() {
$scope.bricks.push(genBrick());
};
$scope.remove = function remove() {
$scope.bricks.splice(
~~(Math.random() * $scope.bricks.length),
1
)
};
});
</script>
</body>
</html>