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

質問編集履歴

2

文章の訂正

2021/05/28 05:07

投稿

mikan23
mikan23

スコア13

title CHANGED
File without changes
body CHANGED
@@ -4,4 +4,75 @@
4
4
  ブラウザバックしてもモーダルが反映されないようにするにはどうしたら良いのでしょうか?
5
5
 
6
6
  お分かりになる方いらっしゃいましたら教えていただきたいです。
7
- よろしくお願いします。
7
+ よろしくお願いします。
8
+ ```html
9
+ <section>
10
+ <a href="#modal_01" class="btn">Modal 01</a>
11
+ <div class="remodal" data-remodal-id="modal_01">
12
+ <div><img src="https://125naroom.com/demo/img/itukanokotonokoto01.jpg" alt="125naroom"></div>
13
+ <button data-remodal-action="cancel" class="remodal-cancel">閉じる</button>
14
+ </div>
15
+ </section>
16
+
17
+ <section>
18
+ <a href="#modal_02" class="btn">Modal 02</a>
19
+ <div class="remodal" data-remodal-id="modal_02">
20
+ <div><img src="https://125naroom.com/demo/img/itukanokotonokoto02.jpg" alt="125naroom"></div>
21
+ <button data-remodal-action="cancel" class="remodal-cancel">閉じる</button>
22
+ </div>
23
+ </section>
24
+
25
+ <section>
26
+ <a href="#modal_03" class="btn">Modal 03</a>
27
+ <div class="remodal" data-remodal-id="modal_03">
28
+ <div><img src="https://125naroom.com/demo/img/itukanokotonokoto03.jpg" alt="125naroom"></div>
29
+ <button data-remodal-action="cancel" class="remodal-cancel">閉じる</button>
30
+ </div>
31
+ </section>
32
+
33
+ <section>
34
+ <a href="#modal_04" class="btn">Modal 04</a>
35
+ <div class="remodal" data-remodal-id="modal_04">
36
+ <div><img src="https://125naroom.com/demo/img/itukanokotonokoto05.jpg" alt="125naroom"></div>
37
+ <button data-remodal-action="cancel" class="remodal-cancel">閉じる</button>
38
+ </div>
39
+ </section>
40
+ ```
41
+ ```css
42
+ .btn {
43
+ display: flex;
44
+ justify-content: center;
45
+ align-items: center;
46
+ background: #ffffff;
47
+ border: 2px solid #b4b1a0;
48
+ color: #4c4833;
49
+ width: 300px;
50
+ height: 80px;
51
+ box-sizing: border-box;
52
+ text-decoration: none;
53
+ transition-duration: 0.3s;
54
+ }
55
+ .btn:hover {
56
+ background: #b4b1a0;
57
+ color: #ffffff;
58
+ }
59
+ .remodal {
60
+ position: relative;
61
+ padding: 25px;
62
+ }
63
+ .remodal img {
64
+ width: 100%;
65
+ height: auto;
66
+ vertical-align: top;
67
+ }
68
+ .remodal-cancel {
69
+ color: #fff;
70
+ background: #000000;
71
+ width: 100%;
72
+ margin-top: 25px;
73
+ }
74
+ .remodal-cancel:hover {
75
+ background: #333;
76
+ }
77
+
78
+ ```

1

c言語削除

2021/05/28 05:07

投稿

mikan23
mikan23

スコア13

title CHANGED
File without changes
body CHANGED
@@ -1,105 +1,7 @@
1
1
  お世話になります。
2
- こちらのサイト様を参考にさせていただいて複数のモーダルを使ってい
2
+ 複数のモーダルを使っているページを作成中で
3
3
  モーダルを開いた状態でブラウザバックするとモーダルが出てきてしまうのですが
4
4
  ブラウザバックしてもモーダルが反映されないようにするにはどうしたら良いのでしょうか?
5
5
 
6
6
  お分かりになる方いらっしゃいましたら教えていただきたいです。
7
- よろしくお願いします。
7
+ よろしくお願いします。
8
-
9
- [リンク内容](https://125naroom.com/demo/remodal.html#)
10
-
11
- ```html
12
- <section>
13
- <a href="#modal_01" class="btn">Modal 01</a>
14
- <div class="remodal" data-remodal-id="modal_01">
15
- <div><img src="https://125naroom.com/demo/img/itukanokotonokoto01.jpg" alt="125naroom"></div>
16
- <button data-remodal-action="cancel" class="remodal-cancel">閉じる</button>
17
- </div>
18
- </section>
19
-
20
- <section>
21
- <a href="#modal_02" class="btn">Modal 02</a>
22
- <div class="remodal" data-remodal-id="modal_02">
23
- <div><img src="https://125naroom.com/demo/img/itukanokotonokoto02.jpg" alt="125naroom"></div>
24
- <button data-remodal-action="cancel" class="remodal-cancel">閉じる</button>
25
- </div>
26
- </section>
27
-
28
- <section>
29
- <a href="#modal_03" class="btn">Modal 03</a>
30
- <div class="remodal" data-remodal-id="modal_03">
31
- <div><img src="https://125naroom.com/demo/img/itukanokotonokoto03.jpg" alt="125naroom"></div>
32
- <button data-remodal-action="cancel" class="remodal-cancel">閉じる</button>
33
- </div>
34
- </section>
35
-
36
- <section>
37
- <a href="#modal_04" class="btn">Modal 04</a>
38
- <div class="remodal" data-remodal-id="modal_04">
39
- <div><img src="https://125naroom.com/demo/img/itukanokotonokoto05.jpg" alt="125naroom"></div>
40
- <button data-remodal-action="cancel" class="remodal-cancel">閉じる</button>
41
- </div>
42
- </section>
43
- ```
44
- ```css
45
- .btn {
46
- display: flex;
47
- justify-content: center;
48
- align-items: center;
49
- background: #ffffff;
50
- border: 2px solid #b4b1a0;
51
- color: #4c4833;
52
- width: 300px;
53
- height: 80px;
54
- box-sizing: border-box;
55
- text-decoration: none;
56
- transition-duration: 0.3s;
57
- }
58
- .btn:hover {
59
- background: #b4b1a0;
60
- color: #ffffff;
61
- }
62
- .remodal {
63
- position: relative;
64
- padding: 25px;
65
- }
66
- .remodal img {
67
- width: 100%;
68
- height: auto;
69
- vertical-align: top;
70
- }
71
- .remodal-cancel {
72
- color: #fff;
73
- background: #000000;
74
- width: 100%;
75
- margin-top: 25px;
76
- }
77
- .remodal-cancel:hover {
78
- background: #333;
79
- }
80
- /*====================================================================
81
- 以下は不要です。
82
- ====================================================================*/
83
- body {
84
- display: flex;
85
- flex-wrap: wrap;
86
- justify-content: space-around;
87
- box-sizing: border-box;
88
- padding: 1em 0;
89
- padding: 50px 0;
90
- font-family: YuGothic, "游ゴシック体", "Yu Gothic", "ヒラギノ角ゴ Pro", "Hiragino Kaku Gothic Pro", "メイリオ", Meiryo, "MS Pゴシック", "MS PGothic", sans-serif;
91
- font-size: 16px;
92
- letter-spacing: .025em;
93
- line-height: 1.8;
94
- margin: 0;
95
- }
96
- section {
97
- width: fit-content;
98
- margin: 0 1% 30px 0;
99
- }
100
- @media screen and (max-width: 1024px) {
101
- body {
102
- font-size: 14px;
103
- }
104
- }
105
- ```