-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
121 lines (103 loc) · 3.81 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
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><palindrom-bunny></title>
<!-- Importing Web Components Polyfill -->
<script src="//unpkg.com/@webcomponents/[email protected]/webcomponents-loader.js"></script>
<!-- Importing Custom Element -->
<script src="palindrom-bunny.js"></script>
<style>
body {
font-family: sans-serif;
min-width: 200px;
width: 70%;
margin: 0 auto;
padding: 30px;
height: 100%;
}
#demo {
display: flex;
justify-content: space-around;
}
#examples {
display: flex;
flex-flow: row wrap;
justify-content: space-between;
align-content: center;
align-items: center;
}
#examples > section {
width: 21em;
margin: 0 2em;
}
iframe {
float: right;
}
.full-width {
width: 100%;
height: 149px;
}
palindrom-bunny {
width: 100%;
position: fixed;
background: #EEE;
left: 75px; /*for margin from the viewport edges, this should be more than img margin-left*/
top: 132px;
width: calc(100vw - 150px); /*for equal margin from the viewport edges, this should (100vw - 2*left) */
}
palindrom-bunny img {
width: 107px; /*for crispness on Hi-DPI, this should be half of the image natural width*/
height: 145px; /*for crispness on Hi-DPI, this should be half of the image natural height*/
margin-left: -53px; /*for horizontal centering, this should be half of the img width*/
}
</style>
</head>
<body>
<a href="https://github.com/Palindrom/palindrom-bunny"><img style="position: absolute; top: 0; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png"
alt="Fork me on GitHub"></a>
<article class="markdown-body hide-scrollbar">
<iframe src="http://ghbtns.com/github-btn.html?user=Palindrom&repo=palindrom-bunny&type=watch&count=true&size=medium"
allowtransparency="true" frameborder="0" scrolling="0" width="90" height="30"></iframe>
<h1><palindrom-bunny></h1>
<p>
Custom element that shows a jumping puppet bunny
</p>
<div class="full-width">
<palindrom-bunny>
<img src="src/puppet.png">
</palindrom-bunny>
</div>
<h2>How to use</h2>
<section id="examples">
<section>
<pre><code>
<palindrom-bunny>
<img src="src/puppet.png">
<!-- This is an image of the bunny that is included with this package. You can also use any other image. -->
</palindrom-bunny>
<style>
palindrom-bunny {
width: 100%;
position: fixed;
background: #EEE;
left: 75px; /*for margin from the viewport edges, this should be more than img margin-left*/
top: 132px;
width: calc(100vw - 150px); /*for equal margin from the viewport edges, this should (100vw - 2*left) */
}
palindrom-bunny img {
width: 107px; /*for crispness on Hi-DPI, this should be half of the image natural width*/
height: 145px; /*for crispness on Hi-DPI, this should be half of the image natural height*/
margin-left: -53px; /*for horizontal centering, this should be half of the img width*/
}
</style>
</code></pre>
</section>
</section>
<h2>Credits</h2>
<footer>bunny photo credit: <a href="https://www.flickr.com/photos/mujitra/4422575066">MIKI Yoshihito</a> (CC BY 2.0)
</footer>
</article>
</body>
</html>