forked from ionic-team/ionic-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscroll.html
More file actions
176 lines (168 loc) · 4.78 KB
/
scroll.html
File metadata and controls
176 lines (168 loc) · 4.78 KB
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<!DOCTYPE html>
<html ng-app="navTest">
<head>
<meta charset="utf-8">
<title>Content</title>
<!-- Sets initial viewport load and disables zooming -->
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet" href="../../../../dist/css/ionic.css">
<script src="../../../../dist/js/ionic.bundle.js"></script>
<style>
.pane {
background-color: #333;
color: #eee;
}
h3 {
margin: 20px 10px !important;
color: #eee;
}
.hours {
width: 1540px;
}
.hours > * {
float: left;
margin: 5px 10px;
}
.hours .icons {
position: relative;
width: 32px;
height: 32px;
}
.hours .icon {
font-size: 24px;
color: #1e1e1e;
position: absolute;
}
.hours .ion-ios7-sunny-outline {
color: yellow;
left: 2px;;
top: 2px;
font-size: 32px;
}
.hours .ion-cloud {
left: 10px;
top: 10px;
color: #fff;
}
</style>
</head>
<body ng-controller="ThisCtrl">
<ion-pane>
<ion-scroll class="has-header" direction="xy" style="width:100%;height:50%;">
<h3>Hourly Forecast</h3>
<div class="hours">
<div ng-repeat="hour in hours">
<div class="icons">
<i class="icon ion-ios7-sunny-outline"></i>
<i class="icon ion-cloud"></i>
</div>
</a>
<div>
{{hour.temp}} °F
</div>
</div>
</div>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<br/><p>...</p>
<a class="button" ng-click="scrollTo()">
Scroll to 100
</a>
<ion-scroll direction="y" style="height: 400px; width: 300px; background: red;">
<div style="width: 100px; height: 4000px; background: url('tree_bark.png') repeat"></div>
</ion-scroll>
</ion-scroll>
</ion-pane>
<script>
angular.module('navTest', ['ionic'])
.directive('hidesHeader', function() {
return {
link: function($scope, $element, $attr) {
var startTop = $element[0].offsetTop;
console.log("Starting", startTop);
}
}
})
.controller('ThisCtrl', function($scope, $ionicScrollDelegate) {
var header = document.getElementById('header');
var content = document.getElementById('container');
$scope.hours = [];
for(var i = 0; i < 24; i++) {
$scope.hours.push({
icon: 'ion-ios7-partlysunny-outline',
temp: 40 + Math.floor(Math.random() * 10)
})
}
$scope.onScrollComplete = function(event, scrollTop, scrollLeft) {
console.log('Scroll complete', scrollTop, scrollLeft);
}
$scope.scrollTo = function() {
console.log('scrollTo');
$ionicScrollDelegate.scrollTo(0, 100, true);
};
$scope.onScroll = function(event, scrollTop, scrollLeft) {
/*
if(scrollTop > startTop) {
var diff = scrollTop - startTop;
console.log(diff);
header.style[ionic.CSS.TRANSFORM] = 'translate3d(0px, -' + diff + 'px, 0)';
content.style.marginTop = -diff + 'px';
}
console.log('Scroll', scrollTop, scrollLeft);
*/
};
})
.controller('AppCtrl', function($scope, $compile, $timeout, $element) {
$scope.items = [];
for(var i = 0; i < 70; i++) {
$scope.items.push({
});
}
$timeout(function() {
$scope.scrollView.resize();
}, 1000);
})
</script>
</body>
</html>