質問編集履歴
2
コードの視認性向上
title
CHANGED
File without changes
|
body
CHANGED
@@ -12,7 +12,8 @@
|
|
12
12
|
端末はMacbook airです。
|
13
13
|
|
14
14
|
コード
|
15
|
+
|
15
|
-
|
16
|
+
```html
|
16
17
|
<!-- ポップアップ -->
|
17
18
|
<div class="popup" id="js-popup">
|
18
19
|
<div class="popup-inner">
|
@@ -55,10 +56,10 @@
|
|
55
56
|
<div class="black-background" id="js-black-bg"></div>
|
56
57
|
</div>
|
57
58
|
|
59
|
+
```
|
58
60
|
|
59
|
-
CSS
|
60
61
|
|
61
|
-
|
62
|
+
```css
|
62
63
|
.popup {
|
63
64
|
position: fixed;
|
64
65
|
left: 0;
|
@@ -143,9 +144,10 @@
|
|
143
144
|
}
|
144
145
|
}
|
145
146
|
|
146
|
-
|
147
|
+
```
|
147
148
|
|
149
|
+
|
148
|
-
|
150
|
+
```javascript
|
149
151
|
function popupImage() {
|
150
152
|
var popup = document.getElementById('js-popup');
|
151
153
|
if(!popup) return;
|
@@ -164,4 +166,5 @@
|
|
164
166
|
});
|
165
167
|
}
|
166
168
|
}
|
167
|
-
popupImage();
|
169
|
+
popupImage();
|
170
|
+
```
|
1
コード等を追加しました。
title
CHANGED
File without changes
|
body
CHANGED
@@ -7,4 +7,161 @@
|
|
7
7
|
|
8
8
|
試しにモーダル外で同コードのフォームを動作確認したところ、正常に動作しました。
|
9
9
|
|
10
|
-
もしわかる方がいましたら、ご教授いただけると幸いです。
|
10
|
+
もしわかる方がいましたら、ご教授いただけると幸いです。
|
11
|
+
|
12
|
+
端末はMacbook airです。
|
13
|
+
|
14
|
+
コード
|
15
|
+
html
|
16
|
+
<!-- ポップアップ -->
|
17
|
+
<div class="popup" id="js-popup">
|
18
|
+
<div class="popup-inner">
|
19
|
+
<div class="close-btn" id="js-close-btn">
|
20
|
+
<!-- <i class="fas fa-times"></i> -->
|
21
|
+
<div class="batsu">×</div>
|
22
|
+
</div>
|
23
|
+
<a href="#">
|
24
|
+
<!-- <img src="./img/popup.jpg" alt="ポップアップ画像"> -->
|
25
|
+
<div class="contact-form">
|
26
|
+
<div class="contact-inner">
|
27
|
+
<p class="contact-title">宿泊予約</p><!-- /.contact-title -->
|
28
|
+
<form action="https://docs.google.com/forms/u/0/d/e/1FAIpQLSeiu2OXn6fYEOh2-9KW-t0mFtIPBiIbBoSD8RRyaRBxqDNmQQ/formResponse" id="form">
|
29
|
+
<div class="box d-flex">
|
30
|
+
<label for="name">お名前</label>
|
31
|
+
<input type="text" name="entry.396652230" id="name" required>
|
32
|
+
</div>
|
33
|
+
<div class="box d-flex">
|
34
|
+
<label for="mail">メールアドレス</label>
|
35
|
+
<input type="mail" name="entry.1934980237" id="mail" required>
|
36
|
+
</div>
|
37
|
+
<div class="box">
|
38
|
+
<p class="box">ご希望プラン(空いているプランのみ表示されます)</p>
|
39
|
+
</div>
|
40
|
+
<div class="box">
|
41
|
+
<select name="plan">
|
42
|
+
<option value="" hidden>プランを選択してください</option>
|
43
|
+
<option value="1">cat</option>
|
44
|
+
<option value="2">dog</option>
|
45
|
+
<option value="3">rabbit</option>
|
46
|
+
<option value="4">squirrel</option>
|
47
|
+
</select>
|
48
|
+
</div>
|
49
|
+
<input type="submit" class="submit-btn" id="js-submit" value="送信する">
|
50
|
+
</form>
|
51
|
+
</div><!-- /.contact-inner -->
|
52
|
+
</div><!-- /.contact-form -->
|
53
|
+
</a>
|
54
|
+
</div>
|
55
|
+
<div class="black-background" id="js-black-bg"></div>
|
56
|
+
</div>
|
57
|
+
|
58
|
+
|
59
|
+
CSS
|
60
|
+
|
61
|
+
//モーダル
|
62
|
+
.popup {
|
63
|
+
position: fixed;
|
64
|
+
left: 0;
|
65
|
+
top: 0;
|
66
|
+
width: 100%;
|
67
|
+
height: 100%;
|
68
|
+
z-index: 9999;
|
69
|
+
opacity: 0;
|
70
|
+
visibility: hidden;
|
71
|
+
transition: .6s;
|
72
|
+
}
|
73
|
+
.popup.is-show {
|
74
|
+
opacity: 1;
|
75
|
+
visibility: visible;
|
76
|
+
}
|
77
|
+
.popup-inner {
|
78
|
+
position: absolute;
|
79
|
+
left: 50%;
|
80
|
+
top: 50%;
|
81
|
+
transform: translate(-50%,-50%);
|
82
|
+
width: 80%;
|
83
|
+
max-width: 500px;
|
84
|
+
padding: 50px;
|
85
|
+
background-color: #fff;
|
86
|
+
z-index: 2;
|
87
|
+
}
|
88
|
+
.popup-inner img {
|
89
|
+
width: 100%;
|
90
|
+
}
|
91
|
+
.close-btn {
|
92
|
+
position: absolute;
|
93
|
+
right: 0;
|
94
|
+
top: 0;
|
95
|
+
width: 50px;
|
96
|
+
height: 50px;
|
97
|
+
line-height: 50px;
|
98
|
+
text-align: center;
|
99
|
+
cursor: pointer;
|
100
|
+
}
|
101
|
+
.close-btn i {
|
102
|
+
font-size: 20px;
|
103
|
+
color: #333;
|
104
|
+
}
|
105
|
+
.black-background {
|
106
|
+
position: absolute;
|
107
|
+
left: 0;
|
108
|
+
top: 0;
|
109
|
+
width: 100%;
|
110
|
+
height: 100%;
|
111
|
+
background-color: rgba(0,0,0,.8);
|
112
|
+
z-index: 1;
|
113
|
+
cursor: pointer;
|
114
|
+
}
|
115
|
+
.batsu{
|
116
|
+
font-size: 300%;
|
117
|
+
font-weight: bold;
|
118
|
+
}
|
119
|
+
|
120
|
+
.contact{
|
121
|
+
&-form{
|
122
|
+
font-size: 1.3rem;
|
123
|
+
color: #333;
|
124
|
+
form{
|
125
|
+
margin-top: 30px;
|
126
|
+
}
|
127
|
+
}
|
128
|
+
&-title{
|
129
|
+
text-align: center;
|
130
|
+
border-bottom: 1px solid #E7E7E7;
|
131
|
+
padding-bottom: 30px;
|
132
|
+
}
|
133
|
+
|
134
|
+
}
|
135
|
+
|
136
|
+
.box{
|
137
|
+
flex-direction: column;
|
138
|
+
label,p{
|
139
|
+
margin-top: 20px;
|
140
|
+
}
|
141
|
+
input,textarea{
|
142
|
+
margin-top: 20px;
|
143
|
+
}
|
144
|
+
}
|
145
|
+
|
146
|
+
javascript
|
147
|
+
|
148
|
+
//モーダル
|
149
|
+
function popupImage() {
|
150
|
+
var popup = document.getElementById('js-popup');
|
151
|
+
if(!popup) return;
|
152
|
+
|
153
|
+
var blackBg = document.getElementById('js-black-bg');
|
154
|
+
var closeBtn = document.getElementById('js-close-btn');
|
155
|
+
var showBtn = document.getElementById('js-show-popup');
|
156
|
+
|
157
|
+
closePopUp(blackBg);
|
158
|
+
closePopUp(closeBtn);
|
159
|
+
closePopUp(showBtn);
|
160
|
+
function closePopUp(elem) {
|
161
|
+
if(!elem) return;
|
162
|
+
elem.addEventListener('click', function() {
|
163
|
+
popup.classList.toggle('is-show');
|
164
|
+
});
|
165
|
+
}
|
166
|
+
}
|
167
|
+
popupImage();
|