teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

7

改善

2017/02/09 13:55

投稿

TATSUY
TATSUY

スコア11

title CHANGED
File without changes
body CHANGED
@@ -293,7 +293,7 @@
293
293
  height: 40px;
294
294
  padding: 0 50px;
295
295
  }
296
- #footer
296
+ footer
297
297
  {
298
298
  background: linear-gradient(-135deg, #E4A972, #9941D8); /* 背景色(黒) */
299
299
  width:100%; /* 横の幅を100% */

6

改善

2017/02/09 13:55

投稿

TATSUY
TATSUY

スコア11

title CHANGED
File without changes
body CHANGED
@@ -115,6 +115,243 @@
115
115
  </body>
116
116
  </html>
117
117
 
118
+
119
+ ```
120
+
121
+ ```**modal.js**
122
+ $(function(){
123
+
124
+ //モーダルウィンドウを出現させるクリックイベント
125
+ $("#modal-open").click( function(){
126
+
127
+ //キーボード操作などにより、オーバーレイが多重起動するのを防止する
128
+ $( this ).blur() ; //ボタンからフォーカスを外す
129
+ if( $( "#modal-overlay" )[0] ) return false ; //新しくモーダルウィンドウを起動しない (防止策1)
130
+ //if($("#modal-overlay")[0]) $("#modal-overlay").remove() ; //現在のモーダルウィンドウを削除して新しく起動する (防止策2)
131
+
132
+ //オーバーレイを出現させる
133
+ $( "body" ).append( '<div id="modal-overlay"></div>' ) ;
134
+ $( "#modal-overlay" ).fadeIn( "slow" ) ;
135
+
136
+ //コンテンツをセンタリングする
137
+ centeringModalSyncer() ;
138
+
139
+ //コンテンツをフェードインする
140
+ $( "#modal-content" ).fadeIn( "slow" ) ;
141
+
142
+ //[#modal-overlay]、または[#modal-close]をクリックしたら…
143
+ $( "#modal-overlay,#modal-close" ).unbind().click( function(){
144
+
145
+ //[#modal-content]と[#modal-overlay]をフェードアウトした後に…
146
+ $( "#modal-content,#modal-overlay" ).fadeOut( "slow" , function(){
147
+
148
+ //[#modal-overlay]を削除する
149
+ $('#modal-overlay').remove() ;
150
+
151
+ } ) ;
152
+
153
+ } ) ;
154
+
155
+ } ) ;
156
+
157
+ //リサイズされたら、センタリングをする関数[centeringModalSyncer()]を実行する
158
+ $( window ).resize( centeringModalSyncer ) ;
159
+
160
+ //センタリングを実行する関数
161
+ function centeringModalSyncer() {
162
+
163
+ //画面(ウィンドウ)の幅、高さを取得
164
+ var w = $( window ).width() ;
165
+ var h = $( window ).height() ;
166
+
167
+ // コンテンツ(#modal-content)の幅、高さを取得
168
+ // jQueryのバージョンによっては、引数[{margin:true}]を指定した時、不具合を起こします。
169
+ // var cw = $( "#modal-content" ).outerWidth( {margin:true} );
170
+ // var ch = $( "#modal-content" ).outerHeight( {margin:true} );
171
+ var cw = $( "#modal-content" ).outerWidth();
172
+ var ch = $( "#modal-content" ).outerHeight();
173
+
174
+ //センタリングを実行する
175
+ $( "#modal-content" ).css( {"left": ((w - cw)/2) + "px","top": ((h - ch)/2) + "px"} ) ;
176
+
177
+ }
178
+
179
+ } ) ;
180
+ ```
181
+
182
+ ```**modal.css**
183
+ @charset "UTF-8";
184
+
185
+ /* ここからデモページ用のコード */
186
+ body {
187
+ width: 100% ;
188
+ height: 5000px ;
189
+ padding: 0 ;
190
+ }
191
+ /* ここまでデモページ用のコード */
192
+
193
+ modal-content {
194
+ width: 50% ;
195
+ margin: 0 ;
196
+ padding: 10px 20px ;
197
+ border: 2px solid #aaa ;
198
+ background: #fff ;
199
+ position: fixed ;
200
+ display: none ;
201
+ z-index: 2 ;
202
+ }
203
+
204
+ modal-overlay {
205
+ z-index: 1 ;
206
+ display: none ;
207
+ position: fixed ;
208
+ top: 0 ;
209
+ left: 0 ;
210
+ width: 100% ;
211
+ height: 120% ;
212
+ background-color: rgba( 0,0,0, 0.75 ) ;
213
+ }
214
+
215
+ .button-link {
216
+ color: #00f ;
217
+ text-decoration: underline ;
218
+ }
219
+
220
+ .button-link:hover {
221
+ cursor: pointer ;
222
+ color: #f00 ;
223
+ }
224
+ ```
225
+
226
+ ```**demo.css**
227
+ html, body
228
+ {
229
+ padding: 0;
230
+ margin: 0;
231
+ }
232
+ body
233
+ {
234
+ background-color: #fff;
235
+ font-family: Arial, Helvetica, Verdana;
236
+ font-size: 14px;
237
+ line-height: 22px;
238
+ color: #666;
239
+ position: relative;
240
+ -webkit-text-size-adjust: none;
241
+ }
242
+ body *
243
+ {
244
+ text-shadow: none;
245
+ }
246
+ h1, h2, h3, h4, h5, h6
247
+ {
248
+ line-height: 1;
249
+ font-weight: bold;
250
+ margin: 20px 0 10px 0;
251
+ }
252
+ h1, h2, h3
253
+ {
254
+ font-size: 18px;
255
+ }
256
+ h4, h5, h6
257
+ {
258
+ font-size: 16px;
259
+ }
260
+ p
261
+ {
262
+ margin: 0 0 10px 0;
263
+ }
264
+ a, a:link, a:active, a:visited, a:hover
265
+ {
266
+ color: inherit;
267
+ text-decoration: underline;
268
+ }
269
+
270
+ nav:not(.mm-menu)
271
+ {
272
+ display: none;
273
+ }
274
+
275
+ .header,
276
+ .content,
277
+ .footer
278
+ {
279
+ text-align: center;
280
+ }
281
+ .header
282
+ {
283
+ background: linear-gradient(-135deg, #E4A972, #9941D8);;
284
+ font-size: 16px;
285
+ font-weight: bold;
286
+ color: #fff;
287
+ line-height: 40px;
288
+
289
+
290
+ -moz-box-sizing: border-box;
291
+ box-sizing: border-box;
292
+ width: 100%;
293
+ height: 40px;
294
+ padding: 0 50px;
295
+ }
296
+ #footer
297
+ {
298
+ background: linear-gradient(-135deg, #E4A972, #9941D8); /* 背景色(黒) */
299
+ width:100%; /* 横の幅を100% */
300
+ height: 30px; /* 縦の幅を120px */
301
+ position: fixed; /* 絶対位置指定することを定義 */
302
+ bottom: 0px; /* 絶対位置指定(左0px,下0px) */
303
+ padding: 10px 0; /* 上下に余白を取る */
304
+ }
305
+
306
+ .pen
307
+ {
308
+ text-align: center;
309
+ }
310
+
311
+
312
+ .header.fixed
313
+ {
314
+ position: fixed;
315
+ top: 0;
316
+ left: 0;
317
+ }
318
+ .footer.fixed
319
+ {
320
+ position: fixed;
321
+ bottom: 0;
322
+ left: 0;
323
+ }
324
+ .header a
325
+ {
326
+ display: block;
327
+ width: 28px;
328
+ height: 18px;
329
+ padding: 11px;
330
+ position: absolute;
331
+ top: 0;
332
+ left: 0;
333
+ }
334
+ .header a:before,
335
+ .header a:after
336
+ {
337
+ content: '';
338
+ display: block;
339
+ background: #fff;
340
+ height: 2px;
341
+ }
342
+ .header a span
343
+ {
344
+ background: #fff;
345
+ display: block;
346
+ height: 2px;
347
+ margin: 6px 0;
348
+ }
349
+ .content
350
+ {
351
+ padding: 150px 50px 50px 50px;
352
+ }
353
+ ```
354
+
118
355
  ###試したこと
119
356
  現状:左上のスライドメニューは機能しませんが、モーダルウィンドウは画像のように表示されます。
120
357
  ![イメージ説明](a09b9e367ab5db7e0bd071acec501e45.png)

5

誤字

2017/02/09 13:54

投稿

TATSUY
TATSUY

スコア11

title CHANGED
File without changes
body CHANGED
@@ -47,7 +47,7 @@
47
47
  <div id="page">
48
48
  <div class="header">
49
49
  <a href="#menu"><span></span></a>
50
- bike-map
50
+ map
51
51
  </div>
52
52
  <nav id="menu">
53
53
  <ul>

4

改善

2017/02/09 13:32

投稿

TATSUY
TATSUY

スコア11

title CHANGED
File without changes
body CHANGED
@@ -116,7 +116,14 @@
116
116
  </html>
117
117
 
118
118
  ###試したこと
119
+ 現状:左上のスライドメニューは機能しませんが、モーダルウィンドウは画像のように表示されます。
120
+ ![イメージ説明](a09b9e367ab5db7e0bd071acec501e45.png)
119
121
 
122
+ コメントを参考にさせていただき
123
+ <script src="../dist/js/jquery.min.js"></script>を消すと
124
+ スライドメニューとモーダルウィンドウは動きましたが、モーダルウィンドウ内の選択ができなくなりました。
125
+ ![イメージ説明](ac1b10359325bcf326b790ac985a5460.png)
126
+
120
127
  ###補足情報(言語/FW/ツール等のバージョンなど)
121
128
  コードブロックに関して
122
129
  ハッシュタグで段落分けされていて誤解を招いた可能性があります。

3

脱字

2017/02/09 13:31

投稿

TATSUY
TATSUY

スコア11

title CHANGED
File without changes
body CHANGED
@@ -119,7 +119,7 @@
119
119
 
120
120
  ###補足情報(言語/FW/ツール等のバージョンなど)
121
121
  コードブロックに関して
122
- #で段落分けされていて誤解を招いた可能性があります。
122
+ ハッシュタグで段落分けされていて誤解を招いた可能性があります。
123
123
  上記のhtmlで一つのコードです。
124
124
  申し訳ございません。
125
125
 

2

ミス

2017/02/09 13:28

投稿

TATSUY
TATSUY

スコア11

title CHANGED
File without changes
body CHANGED
@@ -37,7 +37,7 @@
37
37
  margin: 0;
38
38
  padding: 0;
39
39
  }
40
- #map {
40
+ map {
41
41
  height: 80%;
42
42
  width: 80%;
43
43
  }

1

補足情報

2017/02/09 13:27

投稿

TATSUY
TATSUY

スコア11

title CHANGED
File without changes
body CHANGED
@@ -118,4 +118,11 @@
118
118
  ###試したこと
119
119
 
120
120
  ###補足情報(言語/FW/ツール等のバージョンなど)
121
+ コードブロックに関して
122
+ #で段落分けされていて誤解を招いた可能性があります。
123
+ 上記のhtmlで一つのコードです。
124
+ 申し訳ございません。
125
+
121
- より詳細な情報
126
+ 特定に関して
127
+ jquery.min.jsを読み込むとスライドメニューが動かなくなるので、jqueryの二重読み込みが原因かと
128
+ 安直な考えですいません。