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

質問編集履歴

2

ソースを修正

2020/10/19 11:40

投稿

Nicole0518
Nicole0518

スコア1

title CHANGED
File without changes
body CHANGED
@@ -27,7 +27,7 @@
27
27
  <head>
28
28
  <meta charset="UTF-8">
29
29
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
30
- <title>POKET STAR</title>
30
+ <title>dummy</title>
31
31
  <link rel="stylesheet" type="text/css" href="stylesheets/style.css">
32
32
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
33
33
  <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>

1

ソースの追加

2020/10/19 11:40

投稿

Nicole0518
Nicole0518

スコア1

title CHANGED
File without changes
body CHANGED
@@ -21,20 +21,61 @@
21
21
  iphoneのほうは問題なくスクロールができているため、原因がいまいち特定できない状態です。
22
22
 
23
23
 
24
+ ```html
25
+ <!DOCTYPE html>
26
+ <html lang="ja">
27
+ <head>
28
+ <meta charset="UTF-8">
29
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
24
- -----------------HTMLソース---------------------------
30
+ <title>POKET STAR</title>
31
+ <link rel="stylesheet" type="text/css" href="stylesheets/style.css">
32
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
33
+ <script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
34
+
35
+ </head>
25
- <body>
36
+ <body>
37
+
38
+ <!-- ボタン -->
39
+ <div class="btn", id="btn">
40
+ <p>モーダルウィンドウ</p>
26
- ~省略~
41
+ </div>
42
+
43
+ <!-- モーダルウィンドウ結果表示 -->
27
- <div class="popup" id="js-popup-result">
44
+ <div class="popup" id="js-popup-result">
28
45
  <div class="popup-inner-result" id="popup-inner-result">
29
- ~省略~
30
-    </div>
31
- </div>
46
+ <!-- コンテンツ -->
47
+ <div id="contents">
48
+ </div>
49
+ </div>
50
+ <div class="black-background" id="js-black-bg-result"><div class="close-btn" id="js-close-btn-result"><div class="close-1"><div class="close-2"><i class="fas fa-times"></i></div></div></div></div>
51
+ </div>
32
52
 
33
- </body>
53
+ <!-- Optional JavaScript -->
54
+ <script src="javascripts/script.js"></script>
34
55
 
56
+ </body>
35
57
 
36
- --------------------CSSソース-------------------------
58
+ </html>
37
59
 
60
+ ```
61
+
62
+ ```css
63
+
64
+ .btn{
65
+ background-color: green;
66
+ width:100px;
67
+ height:100px;
68
+
69
+ font-weight: bold;
70
+ }
71
+
72
+
73
+
74
+
75
+ /**************************************
76
+ * モーダルウィンドウ
77
+ **************************************/
78
+
38
79
  .popup {
39
80
  /*position: fixed;*/
40
81
  left: 0;
@@ -46,6 +87,10 @@
46
87
  visibility: hidden;
47
88
  transition: .6s;
48
89
  }
90
+ .popup.is-show {
91
+ opacity: 1;
92
+ visibility: visible;
93
+ }
49
94
 
50
95
  .popup-inner-result {
51
96
  overflow-y: scroll;
@@ -55,10 +100,173 @@
55
100
  transform: translate(-50%,-50%);
56
101
  padding: 5%;
57
102
  background-color: white;
58
- z-index: 2;
103
+ z-index: 10000;
59
104
 
60
105
  border-radius: 3rem;
61
106
 
107
+ -webkit-overflow-scrolling: touch;
108
+ max-height: 100vh;
109
+
62
110
  }
63
111
 
112
+
113
+ @media(max-width: 600px) {
114
+
115
+ .popup-inner-result {
116
+ overflow-y: scroll;
117
+ position: absolute;
118
+ left: 50%;
119
+ top: 50%;
120
+ transform: translate(-50%,-50%);
121
+ padding: 5%;
122
+ background-color: white;
123
+ z-index: 2;
124
+
125
+ border-radius: 3rem;
126
+
127
+ -webkit-overflow-scrolling: touch;
128
+ max-height: 100vh;
129
+
130
+ }
131
+ }
132
+
133
+ .close-btn {
134
+ position: absolute;
135
+ right: 2%;
136
+ top: 2%;
137
+ width: 50px;
138
+ height: 50px;
139
+ line-height: 50px;
140
+ text-align: center;
141
+ cursor: pointer;
142
+ /*background-color: green;*/
143
+ border-radius: 100%;
144
+ font-size: 100%;
145
+ }
146
+
147
+ .close-1{
148
+ height: 30px;
149
+ width: 4px;
150
+ margin-left: 23px;
151
+ background-color: white;
152
+ transform: rotate(45deg);
153
+ Z-index:1;
154
+ }
155
+
156
+ .close-2{
157
+ height: 30px;
158
+ width: 4px;
159
+ background-color: white;
160
+ transform: rotate(90deg);
161
+ Z-index:2;
162
+ }
163
+
164
+
165
+ @media(max-width: 600px) {
166
+ .close-btn {
167
+ width: 30px;
168
+ height: 30px;
169
+ }
170
+
171
+ .close-1{
172
+ height: 30px;
173
+ width: 2.5px;
174
+ margin-left: 14px;
175
+ }
176
+
177
+ .close-2{
178
+ height: 30px;
179
+ width: 2.5px;
180
+ }
181
+ }
182
+
183
+
184
+ .close-btn i {
185
+ font-size: 50px;
186
+ color: #39a9d6;
187
+ }
188
+ .black-background {
189
+ position: absolute;
190
+ left: 0;
191
+ top: 0;
192
+ width: 100%;
193
+ height: 100%;
194
+ background-color: rgba(0,0,0,.8);
195
+ z-index: 1;
196
+ }
197
+
198
+ ```
199
+
200
+ ```javascript
201
+
202
+ var btn = document.getElementById("btn");
203
+ var popupwindowResult = document.getElementById("popup-inner-result");
204
+
205
+
206
+ btn.addEventListener('click', function() {
207
+
208
+ showResultModal();
209
+
210
+ })
211
+
212
+ /***************************************************************
213
+ * 画面初期ロード時
214
+ ****************************************************************/
215
+ window.onload = function(){
216
+
217
+ var sW,sH;
218
+ var width,height;
219
+
220
+ sW = window.innerWidth
221
+ sH = window.innerHeight;
222
+
223
+ //PC画面(横長の場合)
224
+ if(sW >= sH){
225
+ width = sW*0.5;
226
+ height =sH*0.65;
227
+
228
+ }else{
229
+ width = sW*0.6;
230
+ height =sH*0.7;
231
+ }
232
+
233
+ /* ポップアップウィンドウ(結果表示) */
234
+ if(popupwindowResult != null){
64
- --------------------------------------------------------
235
+ popupwindowResult.style.width = width*1.3 + "px";
236
+ popupwindowResult.style.height = height*1.1 + "px";
237
+ }else{
238
+ console.log("ERROR:popupwindowResult is null, Function:window.onload");
239
+ }
240
+
241
+ var table = "";
242
+ var contents = document.getElementById("contents");
243
+
244
+ for(var i = 0; i < 20; i++){
245
+ table = table + "<p>ダミー</p><br>";
246
+ }
247
+
248
+ contents.innerHTML += table;
249
+
250
+ }
251
+
252
+ /*******************************************
253
+ *    結果モーダルウィンドウ表示
254
+ *******************************************/
255
+ function showResultModal(){
256
+ var popup = document.getElementById('js-popup-result');
257
+ if(!popup) return;
258
+ popup.classList.add('is-show');
259
+
260
+ var closeBtn = document.getElementById('js-close-btn-result');
261
+
262
+ closePopUp(closeBtn);
263
+
264
+ function closePopUp(elem) {
265
+ if(!elem) return;
266
+ elem.addEventListener('click', function() {
267
+ popup.classList.remove('is-show');
268
+ })
269
+ }
270
+ }
271
+
272
+ ```