-
Notifications
You must be signed in to change notification settings - Fork 92
/
example1.html
219 lines (182 loc) · 5.45 KB
/
example1.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
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
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!doctype html>
<html>
<!--
Copyright 2015 Google Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<link href="//fonts.googleapis.com/css?family=Roboto|Roboto+Mono" rel="stylesheet">
<script src="treevis.js"></script>
<link href="treevis.css" rel="stylesheet">
</head>
<body>
<div class="treevis example-cards">
<div class="treevis-root framelayout">
<div class="cardlist scrollable nolayer linearlayout vertical">
<div class="card card-1" data-elevation="2">
<span class="card-image" style="background-color: #00BCD4"></span>
<span class="card-title">Bacon</span>
<span class="card-desc">Bacon ipsum dolor amet pork belly meatball kevin spare ribs. Frankfurter swine corned beef meatloaf, strip steak.</span>
</div>
<div class="card card-2" style="position: relative;" data-elevation="2">
<span class="card-image" style="background-color: #FFC107"></span>
<span class="card-title">Ribs</span>
<span class="card-desc">Bacon ipsum dolor amet pork belly meatball kevin spare ribs. Frankfurter swine corned beef meatloaf, strip steak.</span>
</div>
<div class="card card-3" style="position: relative;" data-elevation="2">
<span class="card-image" style="background-color: #00BCD4"></span>
<span class="card-title">Ribs</span>
<span class="card-desc">Bacon ipsum dolor amet pork belly meatball kevin spare ribs. Frankfurter swine corned beef meatloaf, strip steak.</span>
</div>
</div>
<div class="appbar" data-elevation="4">
<svg style="left: 16px;" width="24" height="24" viewBox="0 0 24 24"><path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z"/></svg>
<span class="title">Screen Title</span>
<svg style="right: 16px;" width="8" height="24" viewBox="8 0 8 24"><path d="M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z"/></svg>
</div>
<div class="fab" data-elevation="4">
<svg width="24" height="24" viewBox="0 0 24 24"><path d="M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z"/></svg>
</div>
</div>
</div>
<div class="xmltree">
CoordinatorLayout %.treevis-root
AppBarLayout %.appbar
Toolbar app:layout_scrollFlags=scroll|enterAlways layout_height=?actionBarSize %.appbar
RecyclerView app:layout_behavior=@string/appbar_scrolling_view_behavior %.cardlist
CardView %.card-1
CardView %.card-2
...
FloatingActionButton layout_gravity=bottom|right %.fab
</div>
<script>
var lastScrollTop = 0;
$('.cardlist').on('scroll', function() {
var scrollTop = $(this).scrollTop();
var deltaTop = scrollTop - lastScrollTop;
var appbarTop = $('.appbar').position().top;
console.log(appbarTop);
$('.appbar').css({top:Math.min(0,Math.max(appbarTop - deltaTop, -$('.appbar').height() - 8))});
lastScrollTop = scrollTop;
});
</script>
<style>
/* general */
html, body {
margin: 0;
padding: 0;
overflow: hidden;
width: 100%;
height: 100%;
}
body {
display: flex;
flex-direction: row;
}
.treevis {
flex: 1 0 0;
background: #f7f7f7;
font-family: Roboto;
}
.xmltree {
background: #fff;
flex: 1 0 0;
}
.treevis-root {
background-color: #e5e5e5;
width: 360px;
height: 640px;
}
.fab {
right: 16px;
bottom: 16px;
width: 56px;
height: 56px;
border-radius: 50%;
}
.fab svg {
position: absolute;
width: 24px;
height: 24px;
left: 50%;
top: 50%;
margin-left: -12px;
margin-top: -12px;
}
.cardlist {
height: 100%;
box-sizing: border-box;
padding-top: 56px;
padding-bottom: 88px;
overflow: scroll;
}
.card {
background: #fff;
border-radius: 2px;
overflow: hidden;
}
/* cards example */
.example-cards .appbar {
background-color: #3f51b5;
width: 100%;
height: 56px
}
.example-cards .card {
margin: 8px;
}
.example-cards .card + .card {
margin-top: 0;
}
.example-cards .card-image,
.example-cards .card-title,
.example-cards .card-desc {
display: block;
}
.example-cards .card-image {
height: 164px;
background-size: cover;
}
.example-cards .card-title {
margin: 16px;
font-size: 20px;
font-weight: 500;
color: #000;
}
.example-cards .card-desc {
margin: -8px 16px 16px 16px;
font-size: 14px;
color: #888;
line-height: 18px;
}
.example-cards .appbar {
fill: white;
color: #fff;
}
.example-cards .appbar svg {
position: absolute;
height: 24px;
top: 16px;
}
.example-cards .appbar .title {
position: absolute;
left: 72px;
line-height: 56px;
font-size: 20px;
font-weight: 500;
}
.example-cards .fab {
background-color: #ff4081;
fill: white;
}
</style>
</body>
</html>