質問編集履歴

2

具体例とコードを追加

2020/01/16 06:38

投稿

snoowty
snoowty

スコア23

test CHANGED
File without changes
test CHANGED
@@ -19,3 +19,185 @@
19
19
  Mainの中だけをURLのないようにしたいです。
20
20
 
21
21
  上の三本線のメニューやMainは残したままにしたいです。
22
+
23
+
24
+
25
+ シンプルな例でまずは実装してみることにしました。
26
+
27
+ 以下が具体的なコードの内容です。
28
+
29
+
30
+
31
+ ```html
32
+
33
+ <!DOCTYPE HTML>
34
+
35
+ <html>
36
+
37
+ <head>
38
+
39
+ <meta charset="utf-8">
40
+
41
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover">
42
+
43
+ <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'">
44
+
45
+ <script src="components/loader.js"></script>
46
+
47
+ <script src="lib/onsenui/js/onsenui.min.js"></script>
48
+
49
+
50
+
51
+ <link rel="stylesheet" href="components/loader.css">
52
+
53
+ <link rel="stylesheet" href="lib/onsenui/css/onsenui.css">
54
+
55
+ <link rel="stylesheet" href="lib/onsenui/css/onsen-css-components.css">
56
+
57
+ <link rel="stylesheet" href="css/style.css">
58
+
59
+
60
+
61
+ <script>
62
+
63
+ // Page init event
64
+
65
+ document.addEventListener('init', function(event) {
66
+
67
+ var page = event.target;
68
+
69
+
70
+
71
+ if (page.matches('#first-page')) {
72
+
73
+
74
+
75
+ page.querySelector('#push-button').onclick = function() {
76
+
77
+ document.querySelector('#navigator').pushPage('page2.html');
78
+
79
+ };
80
+
81
+
82
+
83
+ } else if (page.matches('#second-page')) {
84
+
85
+
86
+
87
+ page.querySelector('#pop-button').onclick = function() {
88
+
89
+ document.querySelector('#navigator').popPage();
90
+
91
+ };
92
+
93
+
94
+
95
+ }
96
+
97
+ });
98
+
99
+
100
+
101
+ if (ons.platform.isIPhoneX()) {
102
+
103
+ document.documentElement.setAttribute('onsflag-iphonex-portrait', '');
104
+
105
+ document.documentElement.setAttribute('onsflag-iphonex-landscape', '');
106
+
107
+ }
108
+
109
+ </script>
110
+
111
+
112
+
113
+ <script>
114
+
115
+ function app(){
116
+
117
+ location.href='https://teratail.com/', '_blank'};
118
+
119
+ </script>
120
+
121
+ </head>
122
+
123
+ <body>
124
+
125
+ <ons-navigator id="navigator" page="page1.html"></ons-navigator>
126
+
127
+
128
+
129
+ <ons-template id="page1.html">
130
+
131
+ <ons-page id="first-page">
132
+
133
+ <ons-toolbar>
134
+
135
+ <div class="center">Page 1</div>
136
+
137
+ </ons-toolbar>
138
+
139
+
140
+
141
+ <div class="content" style="text-align: center">
142
+
143
+ <p>This is the first page.</p>
144
+
145
+ <ons-button id="push-button">Push page</ons-button>
146
+
147
+ </div>
148
+
149
+ </ons-page>
150
+
151
+ </ons-template>
152
+
153
+
154
+
155
+ <ons-template id="page2.html">
156
+
157
+ <ons-page id="second-page">
158
+
159
+ <ons-toolbar>
160
+
161
+ <div class="left"><ons-back-button>Page 1</ons-back-button></div>
162
+
163
+ <div class="center">Page 2</div>
164
+
165
+
166
+
167
+ </ons-toolbar>
168
+
169
+
170
+
171
+ <div class="content" style="text-align: center">
172
+
173
+ <p>This is the second page.</p>
174
+
175
+ <ons-button id="pop-button">Pop page</ons-button>
176
+
177
+ <ons-button onclick="app()">テスト</ons-button>
178
+
179
+
180
+
181
+ </div>
182
+
183
+ </ons-page>
184
+
185
+ </ons-template>
186
+
187
+ </body>
188
+
189
+ </html>
190
+
191
+
192
+
193
+ ```
194
+
195
+
196
+
197
+ ![画面遷移1](6b0775487dd46b9c2055010221e061d2.png)
198
+
199
+ ![画面遷移2](6f560f1b3cfb15e85b8c6c32761cdc35.png)
200
+
201
+
202
+
203
+ テストボタンをクリックするとURLが開くのですが、全画面表示になってしまい、上のメニュータブがなくなってしまいます。

1

現在の状況とやりたいことを具体的に追加

2020/01/16 06:37

投稿

snoowty
snoowty

スコア23

test CHANGED
File without changes
test CHANGED
@@ -7,3 +7,15 @@
7
7
 
8
8
 
9
9
  よろしくお願いいたします。
10
+
11
+
12
+
13
+ ![イメージ説明](b21e0dace0ea38ba02e204f9732593b8.png)
14
+
15
+
16
+
17
+
18
+
19
+ Mainの中だけをURLのないようにしたいです。
20
+
21
+ 上の三本線のメニューやMainは残したままにしたいです。