Skip to content

Commit a236a30

Browse files
committed
different item heights demo (not working!)
1 parent 96f3b33 commit a236a30

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>Scroller Demo (scroll bubbles up only after eof/bof) </title>
6+
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.js"></script>
7+
<script src="../../src/ui-scroll.js"></script>
8+
<script src="../../src/ui-scroll-jqlite.js"></script>
9+
<script src="differentItemHeights.js"></script>
10+
<link rel="stylesheet" href="../css/style.css" type="text/css"/>
11+
</head>
12+
<body ng-app="application">
13+
14+
<div class="cont cont-global">
15+
16+
<a class="back" href="../index.html">browse other examples</a>
17+
18+
<h1 class="page-header page-header-exapmle">Scroll bubbles up only after eof/bof</h1>
19+
20+
<div class="viewport-wrap">
21+
<div class="viewport " ui-scroll-viewport>
22+
<div class="item" ui-scroll="item in datasource" style="height: {{item.height}}px">{{item.text}}</div>
23+
</div>
24+
</div>
25+
26+
</div>
27+
28+
</body>
29+
</html>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
angular.module('application', ['ui.scroll', 'ui.scroll.jqlite']).factory('datasource', [
2+
'$log', '$timeout', function(console, $timeout) {
3+
var get, max, min;
4+
min = -50;
5+
max = 100;
6+
7+
get = function(index, count, success) {
8+
$timeout(function() {
9+
var result = [];
10+
var start = Math.max(min, index);
11+
var end = Math.min(index + count - 1, max);
12+
if (start <= end) {
13+
for (var i = start; i <= end; i++) {
14+
var j = i > 0 ? i : (-1) * i;
15+
result.push({
16+
text: "item #" + i,
17+
height: 20 + (j%2) * 10
18+
});
19+
}
20+
}
21+
success(result);
22+
}, 50);
23+
};
24+
25+
return {
26+
get: get
27+
};
28+
}
29+
]);

0 commit comments

Comments
 (0)