This repository has been archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.html
73 lines (73 loc) · 2.33 KB
/
index.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
<!DOCTYPE html>
<html>
<head>
<title>The Panel</title>
<meta charset="utf-8">
<script src="bower_components/polymer/polymer.min.js"></script>
<link rel="import" href="the-panel/the-panel.html">
<style>
body {
margin: 0px;
padding: 0px;
}
the-panel {
background-color: #c0c0c0;
transition: left 0.3s ease-in-out, bottom 0.3s ease-in-out;
}
.node {
width: 75px;
height: 75px;
background-color: #c0c0c0;
border-radius: 10px;
margin: 2px;
}
.toolbar {
text-align: center;
}
</style>
</head>
<body>
<the-panel edge="left">
<header><h1>Left panel</h1></header>
<main></main>
</the-panel>
<the-panel edge="bottom" handle="10" automatic="false">
<header><h1>Bottom panel</h1></header>
<main></main>
</the-panel>
<div class="node">Hello</div>
<div class="node">World</div>
<div class="toolbar">
<button id="addLeft">Add content to left panel</button>
<button id="removeLeft">Remove content from left panel</button>
<button id="addBottom">Add content to bottom panel</button>
<button id="removeBottom">Remove content from bottom panel</button>
</div>
<script>
var leftMain = document.querySelector('the-panel[edge="left"] main');
document.querySelector('#addLeft').addEventListener('click', function () {
var p = document.createElement('p');
p.innerHTML = 'item ' + leftMain.childElementCount;
leftMain.appendChild(p);
});
document.querySelector('#removeLeft').addEventListener('click', function () {
if (!leftMain.childElementCount) {
return;
}
leftMain.removeChild(leftMain.childNodes[0]);
});
var bottomMain = document.querySelector('the-panel[edge="bottom"] main');
document.querySelector('#addBottom').addEventListener('click', function () {
var p = document.createElement('p');
p.innerHTML = 'item ' + bottomMain.childElementCount;
bottomMain.appendChild(p);
});
document.querySelector('#removeBottom').addEventListener('click', function () {
if (!bottomMain.childElementCount) {
return;
}
bottomMain.removeChild(bottomMain.childNodes[0]);
});
</script>
</body>
</html>