Skip to content

Commit 6f79614

Browse files
committed
Jetsnack: use a dropdown list for examples on small screens
1 parent a34ae6f commit 6f79614

File tree

1 file changed

+58
-13
lines changed

1 file changed

+58
-13
lines changed

wasm/jetsnack/index.html

Lines changed: 58 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,12 @@
5858
cursor: pointer;
5959
}
6060

61-
#demos {
61+
#float-panel {
6262
position: absolute;
6363
right: 50px;
6464
}
6565

66-
#demos a:link, a:visited {
66+
#float-panel a:link, a:visited {
6767
background-color: white;
6868
color: black;
6969
border: 1px solid #654ff0;
@@ -75,18 +75,18 @@
7575
height: 20px;
7676
}
7777

78-
#demos a:hover, a:active {
78+
#float-panel a:hover, a:active {
7979
background-color: #804FF0;
8080
color: white;
8181
text-decoration: underline;
8282
}
8383

84-
#demos a.current {
84+
#float-panel a.current {
8585
background-color: #654FF0;
8686
color: white;
8787
}
8888

89-
#demos a.icon {
89+
#float-panel a.icon {
9090
padding-top: 0;
9191
padding-bottom: 10px;
9292
width: 20px;
@@ -95,30 +95,75 @@
9595
background-color: white;
9696
}
9797

98-
#demos a.icon img {
98+
#float-panel a.icon img {
9999
position: relative;
100100
top: 4px;
101101
}
102102

103-
@media only screen and (max-width: 600px) {
103+
#more {
104+
display: none;
105+
}
106+
107+
@media only screen and (max-height: 1000px) {
104108
#footer {
105109
display: none;
106110
}
111+
}
112+
113+
@media only screen and (max-width: 1000px) {
114+
#float-panel {
115+
right: 1px;
116+
}
117+
118+
#float-panel a.icon {
119+
margin-left: -3px;
120+
}
107121

108122
#demos {
109-
right: 5px;
123+
position: absolute;
124+
top: 30px;
125+
right: 40px;
126+
display: none;
127+
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
128+
z-index: 1;
129+
}
130+
#demos.show {
131+
display: block;
132+
}
133+
134+
#demos a {
135+
width: 100px;
136+
}
137+
138+
#more {
139+
border: 1px solid #654ff0;
140+
padding: 4px 1px;
141+
margin-left: -5px;
142+
height: 22px;
143+
display: inline-block;
144+
background-color: white;
110145
}
111146
}
112147
</style>
113148
</head>
114149
<body>
115-
<div id="demos">
116-
<a href="/wasm/iv">Image Viewer</a>
117-
<a href="/wasm/jetsnack" class="current">JetSnack</a>
118-
<a href="/wasm/example">Simple</a>
119-
<a href="/wasm/hello">Hello</a>
150+
151+
<div id="float-panel">
152+
<span id="more">More ▾</span>
153+
<span id="demos">
154+
<a href="/wasm/iv">Image Viewer</a>
155+
<a href="/wasm/jetsnack" class="current">JetSnack</a>
156+
<a href="/wasm/example">Simple</a>
157+
<a href="/wasm/hello">Hello</a>
158+
</span>
120159
<a href="https://kotl.in/wasm-examples" target="_blank" class="icon" title="https://kotl.in/wasm-examples"> <img src="/resources/github-mark.svg" width="20" alt="github"/> </a>
121160
</div>
161+
<script type="application/javascript">
162+
let demos = document.getElementById("demos");
163+
document.getElementById("more").addEventListener("click", (e) => {
164+
demos.classList.toggle("show")
165+
});
166+
</script>
122167

123168
<canvas id="jetsnackCanvas"></canvas>
124169

0 commit comments

Comments
 (0)