Skip to content

Commit daabd3c

Browse files
committed
Different Item Heights demo updates
1 parent 53a9208 commit daabd3c

File tree

3 files changed

+4981
-5
lines changed

3 files changed

+4981
-5
lines changed

demo/differentItemHeights/differentItemHeights.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ <h1 class="page-header page-header-exapmle">Different Item Heights (Interpolatio
2020
<div class="viewport " ui-scroll-viewport>
2121
<div ui-scroll="item in datasource" buffer-size="10" adapter="adapter">
2222
<div class="item" ng-style="{'height': item.height + 'px'}">
23-
{{"content # " + item.index + ' ' + item.height}}
23+
{{"item #" + item.index + ' (h = ' + item.height + ')'}}
2424
</div>
2525
</div>
2626
</div>

demo/differentItemHeights/differentItemHeights.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ angular.module('application', ['ui.scroll'])
88

99
.controller('MainCtrl', function($scope) {
1010
$scope.hello = 'Hello Main Controller!';
11-
var counter = 0;
1211

1312
var reloadListener = $scope.$on('DO_RELOAD', function() {
1413
if ($scope.adapter) {
15-
counter = 0;
1614
$scope.adapter.reload();
1715
}
1816
});
@@ -21,17 +19,18 @@ angular.module('application', ['ui.scroll'])
2119
reloadListener();
2220
});
2321

24-
var min = -1000, max = 1000, delay = 0;
22+
var min = -50, max = 100, delay = 0;
2523

2624
$scope.datasource = {
2725
get: function(index, count, success) {
26+
console.log('Getting ' + count + ' items started from ' + index + '...');
2827
setTimeout(function() {
2928
var result = [];
3029
var start = Math.max(min, index);
3130
var end = Math.min(index + count - 1, max);
3231
if (start <= end) {
3332
for (var i = start; i <= end; i++) {
34-
height = 50 + (counter++ * 2);
33+
height = 50 + (i + 1);
3534
result.push({ index: i, height: height });
3635
}
3736
}

0 commit comments

Comments
 (0)