質問編集履歴

5

markdown修正しました。

2019/08/20 10:33

投稿

ysk_m
ysk_m

スコア17

test CHANGED
File without changes
test CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  流れとしては、
10
10
 
11
- 『私』『相手』2人でそれぞれ199のルーレットを回します。
11
+ 『私』『相手』2人でそれぞれ29のルーレットを回します。
12
12
 
13
13
  スタートは『私』をクリック
14
14
 
@@ -40,11 +40,11 @@
40
40
 
41
41
  昨夜、仕様を少し変更しながら試行錯誤しましたが、ルーレットが止まらなくなりました。
42
42
 
43
- 現在の状況・・・自分のルーレットを回す。stop時の条件分岐入力。しかしstopがそもそも効かず。
43
+ ##現在の状況・・・自分のルーレットを回す。stop時の条件分岐入力。しかしstopがそもそも効かず。
44
-
44
+
45
- HTML 75行目あたりstopの効かせ方がわかりません。カッコの多さに混乱しています。
45
+ #HTML 75行目あたりstopの効かせ方がわかりません。カッコの多さに混乱しています。
46
-
46
+
47
- またstopした際にグー、チョキ、パーのtext入力も同時に行いたいですが、条件分岐の記載は間違っていますでしょうか? ご指導よろしくお願いいたします。
47
+ #またstopした際にグー、チョキ、パーのtext入力も同時に行いたいですが、条件分岐の記載は間違っていますでしょうか? ご指導よろしくお願いいたします。
48
48
 
49
49
  Markdown技法が良く分からず、これで上手く表示されるのかわかりません。
50
50
 

4

markdown修正しました。

2019/08/20 10:33

投稿

ysk_m
ysk_m

スコア17

test CHANGED
File without changes
test CHANGED
@@ -56,7 +56,7 @@
56
56
 
57
57
  ###以下、HTML
58
58
 
59
- ```HTML
59
+ ```HTML
60
60
 
61
61
  <!DOCTYPE html>
62
62
 
@@ -288,13 +288,13 @@
288
288
 
289
289
  </html>
290
290
 
291
- ```
291
+ ```
292
292
 
293
293
 
294
294
 
295
295
  ###以下、CSS
296
296
 
297
- ```CSS
297
+ ```CSS
298
298
 
299
299
  .outline {
300
300
 
@@ -550,4 +550,4 @@
550
550
 
551
551
  }
552
552
 
553
- ```
553
+ ```

3

markdown修正しました。

2019/08/20 10:02

投稿

ysk_m
ysk_m

スコア17

test CHANGED
File without changes
test CHANGED
@@ -56,7 +56,7 @@
56
56
 
57
57
  ###以下、HTML
58
58
 
59
- '''HTML
59
+ ```HTML
60
60
 
61
61
  <!DOCTYPE html>
62
62
 
@@ -288,11 +288,13 @@
288
288
 
289
289
  </html>
290
290
 
291
- '''
291
+ ```
292
+
293
+
292
294
 
293
295
  ###以下、CSS
294
296
 
295
- '''CSS
297
+ ```CSS
296
298
 
297
299
  .outline {
298
300
 
@@ -548,4 +550,4 @@
548
550
 
549
551
  }
550
552
 
551
- '''
553
+ ```

2

2019/08/20 10:01

投稿

ysk_m
ysk_m

スコア17

test CHANGED
File without changes
test CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  → 数字のルーレットが回り数字が決まる
16
16
 
17
- 1-33がグー、34-66がチョキ、67-99がパーで出し手が決まる→出し手を表示
17
+ 0-9がグー、10-19がチョキ、20-29がパーで出し手が決まる→出し手を表示
18
18
 
19
19
 
20
20
 
@@ -54,18 +54,498 @@
54
54
 
55
55
 
56
56
 
57
- ’’’HTML
58
-
59
- <!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="stylesheet" href="style.css"> <title>じゃんけん</title> </head> <body> <header> <h1>ルーレットじゃんけん</h1> </header> <main> <ul> <li id='me_btn'>自分</li> <li id='you_btn'>相手</li> </ul> </main> <div class="random_box"> <div class="outline"> <div class="roulette" id="roulette1">start</div> </div> <div class="outline"> <div class="roulette" id="roulette2">start</div> </div> </div> </div> <div class="text_box"> <p>0〜9 = グー</p> <p>10〜19 = チョキ</p> <p>21〜29 = パー</p> </div> <div class="action_box"> <div id="hands1" class="action_text">自分の出し手</div> <div id="hands2" class="action_text">相手の出し手</div> </div> <footer></footer> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script language="javascript" type="text/javascript"></script> <script> // クリックでルーレット1(自分)を開始 、2回目のクリックでストップ $(function () { var click = 0 var count = 0 var timer = null; var value = Math.floor(Math.random() * 30); $('#me_btn').click(function () { timer = setInterval(Random, 50); function Random() { var value = Math.floor(Math.random() * 30); $('#roulette1').text(value); if (click == 2) { clearInterval(timer); $('#roulette1').text(value); } }; // 止まった数字で条件分岐 // 0〜9 の時 グー // 10〜19 の時 チョキ // 21〜29 の時 パー $(function () { const result = ['グー', 'チョキ', 'パー']; if (click == 2) { $('#roulette1').stop(value); } $('#roulette1').on('stop', function () { $('#hands1').text(result[value]); if (value >= 0 && value <= 9) { $('#hands1').text(result[0]); } else if (value >= 10 && value <= 19) { $('#hands').text(result[1]); } else { $('#hands').text(result[2]); } }); }); }); }); // クリックでルーレット1(自分)を開始 、2回目のクリックでストップ $(function () { var count = 0; var timer = null; var value = Math.floor(Math.random() * 30); $('#you_btn').click(function () { timer = setInterval(Random, 50); function Random() { var value = Math.floor(Math.random() * 30); $('#roulette2').text(value); if (count > 20) { clearInterval(timer); $('#roulette2').text(value); } }; }); }); </script> </body> </html>
60
-
61
- ’’’
62
-
63
-
64
-
65
- 以下、CSS
66
-
67
- ’’’CSS
68
-
69
- .outline { text-align: center; } .random_box{ display: flex; justify-content: space-around; } .roulette { display: inline-block; text-align: center; border: 1px solid #000000; font-size: 40px; width: 120px; height: 100px; background-color: #fff; } body { margin: 0; padding: 0; text-align: left; font-size: 32px; background: url(../backimage2.jpeg) } header { background-color: #fff; border-bottom: 1px solid #ccc; text-align: center; background: url(../guchokipar.jpeg); } header h1{ color:darkblue; font-size: 100px; margin-top: 0; } main { border-bottom: 1px solid #ccc; } footer { background-color: #fff; border-bottom: 1px solid #ccc; text-align: center; } p { font-size: 30px; text-align: left; } ul { display: flex; justify-content: space-around; } li { width: 100px; height: 50px; font-size: 50px; display: inline-block; padding: 0.5em 1em; text-decoration: none; border-radius: 4px; color: #ffffff; background-image: linear-gradient(#6795fd 0%, #67ceff 100%); box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.29); border-bottom: solid 3px #5e7fca; cursor: grab; } li:active { -webkit-transform: translateY(4px); transform: translateY(4px); box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.2); border-bottom: none; } /* _____________________ */ .text_box{ padding: 0; border-top: 1px solid #000000; display: table; table-layout: fixed; width: 100%; } .text_box p{ text-align: center; list-style-type: none; border: 1px solid #666; background-color: #FFF; display: table-cell; } .action_box{ display: flex; justify-content: space-around; margin-top: 40px; } .action_text{ display: inline-block; text-align: center; border: 1px solid #000000; font-size: 40px; width: 150px; height: 150px; background-color: #fff; } footer{ height: 200px; background-color: #fff; border-bottom: 1px solid #ccc; text-align: center; background: url(../guchokipar.jpeg); }
70
-
71
- ’’’
57
+ ###以下、HTML
58
+
59
+ '''HTML
60
+
61
+ <!DOCTYPE html>
62
+
63
+ <html lang="ja">
64
+
65
+
66
+
67
+ <head>
68
+
69
+ <meta charset="UTF-8">
70
+
71
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
72
+
73
+ <meta http-equiv="X-UA-Compatible" content="ie=edge">
74
+
75
+ <link rel="stylesheet" href="style.css">
76
+
77
+ <title>じゃんけん</title>
78
+
79
+
80
+
81
+ </head>
82
+
83
+
84
+
85
+ <body>
86
+
87
+ <header>
88
+
89
+ <h1>ルーレットじゃんけん</h1>
90
+
91
+ </header>
92
+
93
+
94
+
95
+ <main>
96
+
97
+ <ul>
98
+
99
+ <li id='me_btn'>自分</li>
100
+
101
+ <li id='you_btn'>相手</li>
102
+
103
+ </ul>
104
+
105
+ </main>
106
+
107
+
108
+
109
+ <div class="random_box">
110
+
111
+ <div class="outline">
112
+
113
+ <div class="roulette" id="roulette1">start</div>
114
+
115
+ </div>
116
+
117
+ <div class="outline">
118
+
119
+ <div class="roulette" id="roulette2">start</div>
120
+
121
+ </div>
122
+
123
+ </div>
124
+
125
+ </div>
126
+
127
+ <div class="text_box">
128
+
129
+ <p>0〜9 = グー</p>
130
+
131
+ <p>10〜19 = チョキ</p>
132
+
133
+ <p>21〜29 = パー</p>
134
+
135
+ </div>
136
+
137
+
138
+
139
+ <div class="action_box">
140
+
141
+ <div id="hands1" class="action_text">自分の出し手</div>
142
+
143
+ <div id="hands2" class="action_text">相手の出し手</div>
144
+
145
+ </div>
146
+
147
+
148
+
149
+ <footer></footer>
150
+
151
+
152
+
153
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js&quot;&gt;&lt;/script&gt;
154
+
155
+ <script language="javascript" type="text/javascript"></script>
156
+
157
+ <script>
158
+
159
+ // クリックでルーレット1(自分)を開始 、2回目のクリックでストップ
160
+
161
+ $(function () {
162
+
163
+ var click = 0
164
+
165
+ var count = 0
166
+
167
+ var timer = null;
168
+
169
+ var value = Math.floor(Math.random() * 30);
170
+
171
+
172
+
173
+ $('#me_btn').click(function () {
174
+
175
+ timer = setInterval(Random, 50);
176
+
177
+ function Random() {
178
+
179
+ var value = Math.floor(Math.random() * 30);
180
+
181
+ $('#roulette1').text(value);
182
+
183
+ if (click == 2) {
184
+
185
+ clearInterval(timer);
186
+
187
+ $('#roulette1').text(value);
188
+
189
+ }
190
+
191
+ };
192
+
193
+ // 止まった数字で条件分岐
194
+
195
+ // 0〜9 の時 グー
196
+
197
+ // 10〜19 の時 チョキ
198
+
199
+ // 21〜29 の時 パー
200
+
201
+ $(function () {
202
+
203
+ const result = ['グー', 'チョキ', 'パー'];
204
+
205
+ if (click == 2) {
206
+
207
+ $('#roulette1').stop(value);
208
+
209
+ }
210
+
211
+ $('#roulette1').on('stop', function () {
212
+
213
+ $('#hands1').text(result[value]);
214
+
215
+ if (value >= 0 && value <= 9) {
216
+
217
+ $('#hands1').text(result[0]);
218
+
219
+ } else if (value >= 10 && value <= 19) {
220
+
221
+ $('#hands').text(result[1]);
222
+
223
+ } else {
224
+
225
+ $('#hands').text(result[2]);
226
+
227
+ }
228
+
229
+ });
230
+
231
+
232
+
233
+ });
234
+
235
+ });
236
+
237
+ });
238
+
239
+
240
+
241
+
242
+
243
+ // クリックでルーレット1(自分)を開始 、2回目のクリックでストップ
244
+
245
+ $(function () {
246
+
247
+ var count = 0;
248
+
249
+ var timer = null;
250
+
251
+ var value = Math.floor(Math.random() * 30);
252
+
253
+
254
+
255
+ $('#you_btn').click(function () {
256
+
257
+ timer = setInterval(Random, 50);
258
+
259
+ function Random() {
260
+
261
+ var value = Math.floor(Math.random() * 30);
262
+
263
+ $('#roulette2').text(value);
264
+
265
+ if (count > 20) {
266
+
267
+ clearInterval(timer);
268
+
269
+ $('#roulette2').text(value);
270
+
271
+ }
272
+
273
+ };
274
+
275
+ });
276
+
277
+ });
278
+
279
+
280
+
281
+
282
+
283
+ </script>
284
+
285
+ </body>
286
+
287
+
288
+
289
+ </html>
290
+
291
+ '''
292
+
293
+ ###以下、CSS
294
+
295
+ '''CSS
296
+
297
+ .outline {
298
+
299
+ text-align: center;
300
+
301
+ }
302
+
303
+
304
+
305
+ .random_box{
306
+
307
+ display: flex;
308
+
309
+ justify-content: space-around;
310
+
311
+ }
312
+
313
+
314
+
315
+ .roulette {
316
+
317
+ display: inline-block;
318
+
319
+
320
+
321
+ text-align: center;
322
+
323
+ border: 1px solid #000000;
324
+
325
+ font-size: 40px;
326
+
327
+ width: 120px;
328
+
329
+ height: 100px;
330
+
331
+ background-color: #fff;
332
+
333
+ }
334
+
335
+
336
+
337
+ body {
338
+
339
+ margin: 0;
340
+
341
+ padding: 0;
342
+
343
+ text-align: left;
344
+
345
+ font-size: 32px;
346
+
347
+ background: url(../backimage2.jpeg)
348
+
349
+
350
+
351
+ }
352
+
353
+
354
+
355
+ header {
356
+
357
+ background-color: #fff;
358
+
359
+ border-bottom: 1px solid #ccc;
360
+
361
+ text-align: center;
362
+
363
+ background: url(../guchokipar.jpeg);
364
+
365
+ }
366
+
367
+
368
+
369
+ header h1{
370
+
371
+ color:darkblue;
372
+
373
+ font-size: 100px;
374
+
375
+ margin-top: 0;
376
+
377
+ }
378
+
379
+
380
+
381
+ main {
382
+
383
+ border-bottom: 1px solid #ccc;
384
+
385
+ }
386
+
387
+
388
+
389
+ footer {
390
+
391
+ background-color: #fff;
392
+
393
+ border-bottom: 1px solid #ccc;
394
+
395
+ text-align: center;
396
+
397
+ }
398
+
399
+
400
+
401
+ p {
402
+
403
+ font-size: 30px;
404
+
405
+ text-align: left;
406
+
407
+ }
408
+
409
+
410
+
411
+ ul {
412
+
413
+ display: flex;
414
+
415
+ justify-content: space-around;
416
+
417
+ }
418
+
419
+
420
+
421
+ li {
422
+
423
+ width: 100px;
424
+
425
+ height: 50px;
426
+
427
+ font-size: 50px;
428
+
429
+ display: inline-block;
430
+
431
+ padding: 0.5em 1em;
432
+
433
+ text-decoration: none;
434
+
435
+ border-radius: 4px;
436
+
437
+ color: #ffffff;
438
+
439
+ background-image: linear-gradient(#6795fd 0%, #67ceff 100%);
440
+
441
+ box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.29);
442
+
443
+ border-bottom: solid 3px #5e7fca;
444
+
445
+ cursor: grab;
446
+
447
+
448
+
449
+ }
450
+
451
+
452
+
453
+ li:active {
454
+
455
+ -webkit-transform: translateY(4px);
456
+
457
+ transform: translateY(4px);
458
+
459
+ box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.2);
460
+
461
+ border-bottom: none;
462
+
463
+ }
464
+
465
+
466
+
467
+
468
+
469
+ /* _____________________
470
+
471
+ */
472
+
473
+ .text_box{
474
+
475
+ padding: 0;
476
+
477
+ border-top: 1px solid #000000;
478
+
479
+ display: table;
480
+
481
+ table-layout: fixed;
482
+
483
+ width: 100%;
484
+
485
+ }
486
+
487
+
488
+
489
+ .text_box p{
490
+
491
+ text-align: center;
492
+
493
+ list-style-type: none;
494
+
495
+ border: 1px solid #666;
496
+
497
+ background-color: #FFF;
498
+
499
+ display: table-cell;
500
+
501
+ }
502
+
503
+
504
+
505
+ .action_box{
506
+
507
+ display: flex;
508
+
509
+ justify-content: space-around;
510
+
511
+ margin-top: 40px;
512
+
513
+ }
514
+
515
+
516
+
517
+ .action_text{
518
+
519
+ display: inline-block;
520
+
521
+ text-align: center;
522
+
523
+ border: 1px solid #000000;
524
+
525
+ font-size: 40px;
526
+
527
+ width: 150px;
528
+
529
+ height: 150px;
530
+
531
+ background-color: #fff;
532
+
533
+ }
534
+
535
+
536
+
537
+ footer{
538
+
539
+ height: 200px;
540
+
541
+ background-color: #fff;
542
+
543
+ border-bottom: 1px solid #ccc;
544
+
545
+ text-align: center;
546
+
547
+ background: url(../guchokipar.jpeg);
548
+
549
+ }
550
+
551
+ '''

1

コードを記載しました。Markdownの理解が乏しく、表示がダメであればまた編集させてください。

2019/08/20 09:22

投稿

ysk_m
ysk_m

スコア17

test CHANGED
File without changes
test CHANGED
@@ -31,3 +31,41 @@
31
31
  専門用語もよくわからず、質問の仕方も不十分かと思います。
32
32
 
33
33
  何かアドバイスがあればお願いします(◞‸◟)
34
+
35
+
36
+
37
+ 質問の追記です。
38
+
39
+ 現在、途中ですがコードを記載させていただきます。
40
+
41
+ 昨夜、仕様を少し変更しながら試行錯誤しましたが、ルーレットが止まらなくなりました。
42
+
43
+ 現在の状況・・・自分のルーレットを回す。stop時の条件分岐入力。しかしstopがそもそも効かず。
44
+
45
+ HTML 75行目あたりstopの効かせ方がわかりません。カッコの多さに混乱しています。
46
+
47
+ またstopした際にグー、チョキ、パーのtext入力も同時に行いたいですが、条件分岐の記載は間違っていますでしょうか? ご指導よろしくお願いいたします。
48
+
49
+ Markdown技法が良く分からず、これで上手く表示されるのかわかりません。
50
+
51
+ 申し訳ありません。。
52
+
53
+ ダメであればまた編集させてください。
54
+
55
+
56
+
57
+ ’’’HTML
58
+
59
+ <!DOCTYPE html> <html lang="ja"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="stylesheet" href="style.css"> <title>じゃんけん</title> </head> <body> <header> <h1>ルーレットじゃんけん</h1> </header> <main> <ul> <li id='me_btn'>自分</li> <li id='you_btn'>相手</li> </ul> </main> <div class="random_box"> <div class="outline"> <div class="roulette" id="roulette1">start</div> </div> <div class="outline"> <div class="roulette" id="roulette2">start</div> </div> </div> </div> <div class="text_box"> <p>0〜9 = グー</p> <p>10〜19 = チョキ</p> <p>21〜29 = パー</p> </div> <div class="action_box"> <div id="hands1" class="action_text">自分の出し手</div> <div id="hands2" class="action_text">相手の出し手</div> </div> <footer></footer> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script language="javascript" type="text/javascript"></script> <script> // クリックでルーレット1(自分)を開始 、2回目のクリックでストップ $(function () { var click = 0 var count = 0 var timer = null; var value = Math.floor(Math.random() * 30); $('#me_btn').click(function () { timer = setInterval(Random, 50); function Random() { var value = Math.floor(Math.random() * 30); $('#roulette1').text(value); if (click == 2) { clearInterval(timer); $('#roulette1').text(value); } }; // 止まった数字で条件分岐 // 0〜9 の時 グー // 10〜19 の時 チョキ // 21〜29 の時 パー $(function () { const result = ['グー', 'チョキ', 'パー']; if (click == 2) { $('#roulette1').stop(value); } $('#roulette1').on('stop', function () { $('#hands1').text(result[value]); if (value >= 0 && value <= 9) { $('#hands1').text(result[0]); } else if (value >= 10 && value <= 19) { $('#hands').text(result[1]); } else { $('#hands').text(result[2]); } }); }); }); }); // クリックでルーレット1(自分)を開始 、2回目のクリックでストップ $(function () { var count = 0; var timer = null; var value = Math.floor(Math.random() * 30); $('#you_btn').click(function () { timer = setInterval(Random, 50); function Random() { var value = Math.floor(Math.random() * 30); $('#roulette2').text(value); if (count > 20) { clearInterval(timer); $('#roulette2').text(value); } }; }); }); </script> </body> </html>
60
+
61
+ ’’’
62
+
63
+
64
+
65
+ 以下、CSS
66
+
67
+ ’’’CSS
68
+
69
+ .outline { text-align: center; } .random_box{ display: flex; justify-content: space-around; } .roulette { display: inline-block; text-align: center; border: 1px solid #000000; font-size: 40px; width: 120px; height: 100px; background-color: #fff; } body { margin: 0; padding: 0; text-align: left; font-size: 32px; background: url(../backimage2.jpeg) } header { background-color: #fff; border-bottom: 1px solid #ccc; text-align: center; background: url(../guchokipar.jpeg); } header h1{ color:darkblue; font-size: 100px; margin-top: 0; } main { border-bottom: 1px solid #ccc; } footer { background-color: #fff; border-bottom: 1px solid #ccc; text-align: center; } p { font-size: 30px; text-align: left; } ul { display: flex; justify-content: space-around; } li { width: 100px; height: 50px; font-size: 50px; display: inline-block; padding: 0.5em 1em; text-decoration: none; border-radius: 4px; color: #ffffff; background-image: linear-gradient(#6795fd 0%, #67ceff 100%); box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.29); border-bottom: solid 3px #5e7fca; cursor: grab; } li:active { -webkit-transform: translateY(4px); transform: translateY(4px); box-shadow: 0px 0px 1px rgba(0, 0, 0, 0.2); border-bottom: none; } /* _____________________ */ .text_box{ padding: 0; border-top: 1px solid #000000; display: table; table-layout: fixed; width: 100%; } .text_box p{ text-align: center; list-style-type: none; border: 1px solid #666; background-color: #FFF; display: table-cell; } .action_box{ display: flex; justify-content: space-around; margin-top: 40px; } .action_text{ display: inline-block; text-align: center; border: 1px solid #000000; font-size: 40px; width: 150px; height: 150px; background-color: #fff; } footer{ height: 200px; background-color: #fff; border-bottom: 1px solid #ccc; text-align: center; background: url(../guchokipar.jpeg); }
70
+
71
+ ’’’