質問編集履歴
2
test
CHANGED
File without changes
|
test
CHANGED
@@ -238,7 +238,7 @@
|
|
238
238
|
|
239
239
|
```html
|
240
240
|
|
241
|
-
<
|
241
|
+
<h1 id="time"></h1>
|
242
242
|
|
243
243
|
```
|
244
244
|
|
1
コードの全文とcodepenのサンプルを追記しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,5 +1,155 @@
|
|
1
1
|
```html
|
2
2
|
|
3
|
+
<!DOCTYPE HTML>
|
4
|
+
|
5
|
+
<html>
|
6
|
+
|
7
|
+
<head>
|
8
|
+
|
9
|
+
<meta charset="utf-8">
|
10
|
+
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover">
|
12
|
+
|
13
|
+
<meta http-equiv="Content-Security-Policy" content="default-src * data: gap: https://ssl.gstatic.com; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'">
|
14
|
+
|
15
|
+
<script src="components/loader.js"></script>
|
16
|
+
|
17
|
+
<script src="lib/onsenui/js/onsenui.min.js"></script>
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
<link rel="stylesheet" href="components/loader.css">
|
22
|
+
|
23
|
+
<link rel="stylesheet" href="lib/onsenui/css/onsenui.css">
|
24
|
+
|
25
|
+
<link rel="stylesheet" href="lib/onsenui/css/onsen-css-components.css">
|
26
|
+
|
27
|
+
<link rel="stylesheet" href="css/style.css">
|
28
|
+
|
29
|
+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
<script>
|
34
|
+
|
35
|
+
ons.ready(function(){
|
36
|
+
|
37
|
+
document.addEventListener('init', function(event) {
|
38
|
+
|
39
|
+
time();
|
40
|
+
|
41
|
+
setInterval(time,1000);
|
42
|
+
|
43
|
+
}, false);
|
44
|
+
|
45
|
+
});
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
function time(){
|
50
|
+
|
51
|
+
var now = new Date();
|
52
|
+
|
53
|
+
document.getElementById("time").innerHTML = now.toLocaleTimeString();
|
54
|
+
|
55
|
+
}
|
56
|
+
|
57
|
+
ons.ready(function() {
|
58
|
+
|
59
|
+
console.log("Onsen UI is ready!");
|
60
|
+
|
61
|
+
});
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
window.fn = {};
|
66
|
+
|
67
|
+
window.fn.open = function() {
|
68
|
+
|
69
|
+
var menu = document.getElementById('menu');
|
70
|
+
|
71
|
+
menu.open();
|
72
|
+
|
73
|
+
};
|
74
|
+
|
75
|
+
window.fn.load = function(page) {
|
76
|
+
|
77
|
+
var content = document.getElementById('content');
|
78
|
+
|
79
|
+
var menu = document.getElementById('menu');
|
80
|
+
|
81
|
+
content
|
82
|
+
|
83
|
+
.load(page)
|
84
|
+
|
85
|
+
.then(menu.close.bind(menu));
|
86
|
+
|
87
|
+
};
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
if (ons.platform.isIPhoneX()) {
|
92
|
+
|
93
|
+
document.documentElement.setAttribute('onsflag-iphonex-portrait', '');
|
94
|
+
|
95
|
+
document.documentElement.setAttribute('onsflag-iphonex-landscape', '');
|
96
|
+
|
97
|
+
}
|
98
|
+
|
99
|
+
</script>
|
100
|
+
|
101
|
+
</head>
|
102
|
+
|
103
|
+
<body>
|
104
|
+
|
105
|
+
<ons-splitter>
|
106
|
+
|
107
|
+
<ons-splitter-side id="menu" side="left" width="220px" collapse swipeable>
|
108
|
+
|
109
|
+
<ons-page>
|
110
|
+
|
111
|
+
<ons-list>
|
112
|
+
|
113
|
+
<ons-list-item onclick="fn.load('home.html')" tappable>
|
114
|
+
|
115
|
+
<h5><i style="float: left;"class="material-icons blue">home</i>Home</h5>
|
116
|
+
|
117
|
+
</ons-list-item>
|
118
|
+
|
119
|
+
<ons-list-item onclick="fn.load('settings.html')" tappable>
|
120
|
+
|
121
|
+
<h5><i style="float: left;"class="material-icons blue">settings</i>Settings</h5>
|
122
|
+
|
123
|
+
</ons-list-item>
|
124
|
+
|
125
|
+
<ons-list-item onclick="fn.load('about.html')" tappable>
|
126
|
+
|
127
|
+
<h5><i style="float: left;"class="material-icons blue">pie_chart</i>Chart</h5>
|
128
|
+
|
129
|
+
</ons-list-item>
|
130
|
+
|
131
|
+
<ons-list-item onclick="fn.load('about.html')" tappable>
|
132
|
+
|
133
|
+
<h5><i style="float: left;"class="material-icons blue">help_outline</i>How To</h5>
|
134
|
+
|
135
|
+
</ons-list-item>
|
136
|
+
|
137
|
+
</ons-list>
|
138
|
+
|
139
|
+
</ons-page>
|
140
|
+
|
141
|
+
</ons-splitter-side>
|
142
|
+
|
143
|
+
<ons-splitter-content id="content" page="home.html"></ons-splitter-content>
|
144
|
+
|
145
|
+
</ons-splitter>
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
<ons-template id="home.html">
|
150
|
+
|
151
|
+
<ons-page>
|
152
|
+
|
3
153
|
<ons-toolbar-button onclick="fn.open()">
|
4
154
|
|
5
155
|
<i style="float: left;"class="material-icons bigblue">reorder</i>
|
@@ -8,6 +158,80 @@
|
|
8
158
|
|
9
159
|
<i style="float: right;"class="material-icons bigblue">help_outline</i>
|
10
160
|
|
161
|
+
<h1 id="time"></h1>
|
162
|
+
|
163
|
+
</ons-page>
|
164
|
+
|
165
|
+
</ons-template>
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
<ons-template id="settings.html">
|
170
|
+
|
171
|
+
<ons-page>
|
172
|
+
|
173
|
+
<ons-toolbar>
|
174
|
+
|
175
|
+
<div class="left">
|
176
|
+
|
177
|
+
<ons-toolbar-button onclick="fn.open()">
|
178
|
+
|
179
|
+
<ons-icon icon="ion-navicon, material:md-menu"></ons-icon>
|
180
|
+
|
181
|
+
</ons-toolbar-button>
|
182
|
+
|
183
|
+
</div>
|
184
|
+
|
185
|
+
<div class="center">
|
186
|
+
|
187
|
+
Settings
|
188
|
+
|
189
|
+
</div>
|
190
|
+
|
191
|
+
</ons-toolbar>
|
192
|
+
|
193
|
+
</ons-page>
|
194
|
+
|
195
|
+
</ons-template>
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
<ons-template id="about.html">
|
200
|
+
|
201
|
+
<ons-page>
|
202
|
+
|
203
|
+
<ons-toolbar>
|
204
|
+
|
205
|
+
<div class="left">
|
206
|
+
|
207
|
+
<ons-toolbar-button onclick="fn.open()">
|
208
|
+
|
209
|
+
<ons-icon icon="ion-navicon, material:md-menu"></ons-icon>
|
210
|
+
|
211
|
+
</ons-toolbar-button>
|
212
|
+
|
213
|
+
</div>
|
214
|
+
|
215
|
+
<div class="center">
|
216
|
+
|
217
|
+
About
|
218
|
+
|
219
|
+
</div>
|
220
|
+
|
221
|
+
</ons-toolbar>
|
222
|
+
|
223
|
+
</ons-page>
|
224
|
+
|
225
|
+
</ons-template>
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
</body>
|
230
|
+
|
231
|
+
</html>
|
232
|
+
|
233
|
+
|
234
|
+
|
11
235
|
```
|
12
236
|
|
13
237
|
上記の状態で右と左にアイコンが並ぶのですが、その間に
|
@@ -18,8 +242,68 @@
|
|
18
242
|
|
19
243
|
```
|
20
244
|
|
21
|
-
を挟みたいのですが、
|
245
|
+
を挟みたいのですが、
|
246
|
+
|
22
|
-
|
247
|
+
```html
|
248
|
+
|
249
|
+
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
250
|
+
|
251
|
+
<div class="f-container">
|
252
|
+
|
253
|
+
<div class="f-item"><ons-toolbar-button onclick="fn.open()">
|
254
|
+
|
255
|
+
<i style="float: left;"class="material-icons bigblue">reorder</i>
|
256
|
+
|
257
|
+
</ons-toolbar-button></div>
|
258
|
+
|
259
|
+
<div class="f-item"><h1 id="time">a</h1></div>
|
260
|
+
|
261
|
+
<div class="f-item"><i style="float: right;"class="material-icons bigblue">help_outline</i></div>
|
262
|
+
|
263
|
+
</div>
|
264
|
+
|
265
|
+
```
|
266
|
+
|
267
|
+
上記のコードと
|
268
|
+
|
269
|
+
```css
|
270
|
+
|
271
|
+
.f-container {
|
272
|
+
|
273
|
+
display:flex;
|
274
|
+
|
275
|
+
flex-diretion: row;
|
276
|
+
|
277
|
+
}
|
278
|
+
|
279
|
+
```
|
280
|
+
|
281
|
+
```js
|
282
|
+
|
283
|
+
ons.ready(function(){
|
284
|
+
|
285
|
+
document.addEventListener('init', function(event) {
|
286
|
+
|
287
|
+
time();
|
288
|
+
|
23
|
-
|
289
|
+
setInterval(time,1000);
|
290
|
+
|
291
|
+
}, false);
|
292
|
+
|
293
|
+
});
|
294
|
+
|
295
|
+
|
296
|
+
|
297
|
+
function time(){
|
298
|
+
|
299
|
+
var now = new Date();
|
300
|
+
|
301
|
+
document.getElementById("time").innerHTML = now.toLocaleTimeString();
|
302
|
+
|
303
|
+
}
|
304
|
+
|
305
|
+
```
|
306
|
+
|
307
|
+
と[codepen](https://codepen.io/TaiyakiX/pen/VwwqLqW)にかいたのですが、見ればわかるとおりまず時間が表示されないのと、<h1></h1>の中だけ少し低くなってしまいます。これを直すにはどうすればいいでしょうか。
|
24
308
|
|
25
309
|
Monacaで動かすのを前提でお願いします。
|