forked from googlearchive/paper-shadow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
134 lines (105 loc) · 2.5 KB
/
demo.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
<!doctype html>
<!--
Copyright 2013 The Polymer Authors. All rights reserved.
Use of this source code is governed by a BSD-style
license that can be found in the LICENSE file.
-->
<html>
<head>
<title>paper-shadow</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
<script src="../webcomponentsjs/webcomponents.js"></script>
<link href="paper-shadow.html" rel="import">
<style>
body {
font-family: RobotoDraft, 'Helvetica Neue', Helvetica, Arial;
font-size: 14px;
margin: 0;
padding: 24px;
-webkit-tap-highlight-color: rgba(0,0,0,0);
-webkit-touch-callout: none;
}
section {
padding: 20px 0;
}
section > div {
padding: 14px;
font-size: 16px;
}
.card {
display: inline-block;
background: white;
box-sizing: border-box;
width: 100px;
height: 100px;
margin: 16px;
padding: 16px;
border-radius: 2px;
}
.fab {
display: inline-block;
background: white;
box-sizing: border-box;
width: 56px;
height: 56px;
margin: 16px;
padding: 16px;
border-radius: 50%;
text-align: center;
}
</style>
</head>
<body unresolved>
<template is="auto-binding">
<section>
<div>Shadows</div>
<paper-shadow class="card" z="0">
z = 0
</paper-shadow>
<paper-shadow class="card" z="1">
z = 1
</paper-shadow>
<paper-shadow class="card" z="2">
z = 2
</paper-shadow>
<paper-shadow class="card" z="3">
z = 3
</paper-shadow>
<paper-shadow class="card" z="4">
z = 4
</paper-shadow>
<paper-shadow class="card" z="5">
z = 5
</paper-shadow>
</section>
<section on-tap="{{tapAction}}">
<div>Animated</div>
<paper-shadow class="card" z="0" animated>
tap
</paper-shadow>
<paper-shadow class="fab" z="0" animated layout center-center>
tap
</paper-shadow>
</section>
</template>
<script>
var scope = document.querySelector('template[is=auto-binding]');
scope.tapAction = function(e) {
var target = e.target;
if (!target.down) {
target.setZ(target.z + 1);
if (target.z === 5) {
target.down = true;
}
} else {
target.setZ(target.z - 1);
if (target.z === 0) {
target.down = false;
}
}
};
</script>
</body>
</html>