-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
92 lines (84 loc) · 2.31 KB
/
test.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
<!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>Panel Slider</title>
<script src="../polymer-all/polymer/polymer.js"></script>
<link rel="import" href="g-panel-slider.html">
<style>
html, body {
height: 100%;
margin: 0;
background: whitesmoke;
}
body {
display: -webkit-box;
display: -webkit-flex;
display: flex;
-webkit-box-orient: vertical;
-webkit-flex-flow: column;
flex-direction: column;
}
.controls {
padding: 10px;
}
g-panel-slider {
counter-reset: section;
-webkit-box-flex: 1;
-webkit-flex: 1;
flex: 1;
outline: none;
border: 1px solid #ccc;
position: relative;
overflow: hidden;
font-size: 30px;
}
g-panels > * {
padding: 10px;
box-sizing: border-box;
}
</style>
</head>
<body>
<div class="controls">
<button onclick="previous();">«</button>
<button onclick="next();">»</button>
<button onclick="addPanel();">+</button>
</div>
<g-panel-slider selected="zing" transition="keyframe" class="g-panels g-panels-hslide">
<section name="foo" style="background: lightsteelblue;">Panel 1</section>
<section name="zonk" style="background: tomato;">Panel 2</section>
<section name="bar" style="background: beige;">Panel 3
<div>foo</div>
<div>bar</div>
<div>baz</div>
</section>
<section name="zing" style="background: silver;">Panel 4</section>
<section name="baz" style="background: whitesmoke;" class="right">Panel 5</section>
</g-panel-slider>
<script>
document.addEventListener("WebComponentsReady", function() {
panels = document.querySelector("g-panel-slider");
next = function() {
panels.next();
}
previous = function() {
panels.previous();
}
addPanel = function() {
var p = document.createElement('section');
p.style.background = 'hsla(' + Math.round(Math.random() * 360) + ', 60%, 30%, 1)';
p.textContent = 'Panel ' + ++panels.count;
panels.appendChild(p);
panels.panelAdded(p);
panels.index = panels.count;
}
panels.focus();
});
</script>
</body>
</html>