質問編集履歴

2

CSSの記述

2020/03/30 05:49

投稿

syosinsya9999
syosinsya9999

スコア6

test CHANGED
File without changes
test CHANGED
@@ -297,3 +297,123 @@
297
297
  できたことは、画像がきちんと整列したわけじゃないですが、ランダムに出てきた事です。
298
298
 
299
299
  因みにログはビルダーなのででてきません。
300
+
301
+
302
+
303
+ CSSの方の記述です、よろしくお願いします。
304
+
305
+ ```ここに言語を入力
306
+
307
+ body {
308
+
309
+ font-family: sans-serif;
310
+
311
+ line-height: 1.4;
312
+
313
+ font-size: 18px;
314
+
315
+ padding: 20px;
316
+
317
+ max-width: 640px;
318
+
319
+ margin: 0 auto;
320
+
321
+ }
322
+
323
+
324
+
325
+ .grid {
326
+
327
+ max-width: 1200px;
328
+
329
+ }
330
+
331
+
332
+
333
+ /* reveal grid after images loaded */
334
+
335
+ .grid.are-images-unloaded {
336
+
337
+ opacity: 0;
338
+
339
+ }
340
+
341
+
342
+
343
+ .grid__item,
344
+
345
+ .grid__col-sizer {
346
+
347
+ width: 32%;
348
+
349
+ }
350
+
351
+
352
+
353
+ .grid__gutter-sizer { width: 2%; }
354
+
355
+
356
+
357
+ /* hide by default */
358
+
359
+ .grid.are-images-unloaded .image-grid__item {
360
+
361
+ opacity: 0;
362
+
363
+ }
364
+
365
+
366
+
367
+ .grid__item {
368
+
369
+ margin-bottom: 20px;
370
+
371
+ float: left;
372
+
373
+ }
374
+
375
+
376
+
377
+ .grid__item--height1 { height: 140px; background: #EA0; }
378
+
379
+ .grid__item--height2 { height: 220px; background: #C25; }
380
+
381
+ .grid__item--height3 { height: 300px; background: #19F; }
382
+
383
+
384
+
385
+ .grid__item--width2 { width: 66%; }
386
+
387
+
388
+
389
+ .grid__item img {
390
+
391
+ display: block;
392
+
393
+ max-width: 100%;
394
+
395
+ }
396
+
397
+
398
+
399
+
400
+
401
+ .page-load-status {
402
+
403
+ display: none; /* hidden by default */
404
+
405
+ padding-top: 20px;
406
+
407
+ border-top: 1px solid #DDD;
408
+
409
+ text-align: center;
410
+
411
+ color: #777;
412
+
413
+ }
414
+
415
+
416
+
417
+ /* loader ellips in separate pen CSS */
418
+
419
+ ```

1

コードの追加

2020/03/30 05:49

投稿

syosinsya9999
syosinsya9999

スコア6

test CHANGED
File without changes
test CHANGED
@@ -17,3 +17,283 @@
17
17
  ご教示いただけるなら必要な情報は書いていくつもりです。
18
18
 
19
19
  よろしくお願いします。
20
+
21
+
22
+
23
+ ```ここに言語を入力
24
+
25
+ <html>
26
+
27
+ <head>
28
+
29
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
30
+
31
+ <meta http-equiv="Content-Style-Type" content="text/css">
32
+
33
+ <meta name="GENERATOR" content="JustSystems Homepage Builder Version 21.0.5.0 for Windows">
34
+
35
+ <link rel="stylesheet" type="text/css" href="css/style.css">
36
+
37
+ <script src="js/jquery-3.4.1.min.js"></script> <script type="text/javascript" src="https://unpkg.com/infinite-scroll@3/dist/infinite-scroll.pkgd.min.js"></script> <script type="text/javascirpt" src="https://unpkg.com/masonry-layout@4/dist/masonry.pkgd.min.js"></script> <script type="text/javascript" src="https://unpkg.com/imagesloaded@4/imagesloaded.pkgd.min.js"></script> <script>
38
+
39
+ $(function(){
40
+
41
+ var $grid = $('.grid');
42
+
43
+ $grid.masonry({
44
+
45
+ itemSelector: 'none',
46
+
47
+ columnWidth: '.grid__item',
48
+
49
+ gutter: 20,
50
+
51
+ stagger: 30,
52
+
53
+ percentPosition: true,
54
+
55
+ visibleStyle: { transform: 'translateY(0)', opacity: 1 },
56
+
57
+ hiddenStyle: { transform: 'translateY(100px)', opacity: 0 },
58
+
59
+ });
60
+
61
+
62
+
63
+ var msnry = $grid.data('masonry');
64
+
65
+
66
+
67
+ $grid.imagesLoaded(function() {
68
+
69
+ $grid.masonry( 'option', { itemSelector: '.grid__item' });
70
+
71
+ var $items = $grid.find('.grid__item');
72
+
73
+ $grid.masonry( 'appended', $items );
74
+
75
+ });
76
+
77
+
78
+
79
+ var nextSlugs = [
80
+
81
+ 'page2.html',
82
+
83
+ 'page3.html'
84
+
85
+ ];
86
+
87
+
88
+
89
+ function getPath() {
90
+
91
+ var slug = nextSlugs[ this.loadCount ];
92
+
93
+ if( slug ) {
94
+
95
+ return 'https://www.miso.blog/demo/masonry_infinitescroll/';
96
+
97
+ }
98
+
99
+ }
100
+
101
+
102
+
103
+ $grid.infiniteScroll({
104
+
105
+ path: getPath,
106
+
107
+ append: '.grid__item',
108
+
109
+ outlayer: msnry,
110
+
111
+ scrollThreshold: 40,
112
+
113
+ hideNav: '.pagination',
114
+
115
+ status: '.page-load-status',
116
+
117
+ });
118
+
119
+ });
120
+
121
+ </script> <script>
122
+
123
+ //-------------------------------------//
124
+
125
+ // init Masonry
126
+
127
+
128
+
129
+ var $grid = $('.grid').masonry({
130
+
131
+ itemSelector: 'none', // select none at first
132
+
133
+ columnWidth: '.grid__col-sizer',
134
+
135
+ gutter: '.grid__gutter-sizer',
136
+
137
+ percentPosition: true,
138
+
139
+ stagger: 30,
140
+
141
+ // nicer reveal transition
142
+
143
+ visibleStyle: { transform: 'translateY(0)', opacity: 1 },
144
+
145
+ hiddenStyle: { transform: 'translateY(100px)', opacity: 0 },
146
+
147
+ });
148
+
149
+
150
+
151
+ // get Masonry instance
152
+
153
+ var msnry = $grid.data('masonry');
154
+
155
+
156
+
157
+ // initial items reveal
158
+
159
+ $grid.imagesLoaded( function() {
160
+
161
+ $grid.removeClass('are-images-unloaded');
162
+
163
+ $grid.masonry( 'option', { itemSelector: '.grid__item' });
164
+
165
+ var $items = $grid.find('.grid__item');
166
+
167
+ $grid.masonry( 'appended', $items );
168
+
169
+ });
170
+
171
+
172
+
173
+ //-------------------------------------//
174
+
175
+ // hack CodePen to load pens as pages
176
+
177
+
178
+
179
+ var nextPenSlugs = [
180
+
181
+ '202252c2f5f192688dada252913ccf13',
182
+
183
+ 'a308f05af22690139e9a2bc655bfe3ee',
184
+
185
+ '6c9ff23039157ee37b3ab982245eef28',
186
+
187
+ ];
188
+
189
+
190
+
191
+ function getPenPath() {
192
+
193
+ var slug = nextPenSlugs[ this.loadCount ];
194
+
195
+ if ( slug ) {
196
+
197
+ return 'https://s.codepen.io/desandro/debug/' + slug;
198
+
199
+ }
200
+
201
+ }
202
+
203
+
204
+
205
+ //-------------------------------------//
206
+
207
+ // init Infinte Scroll
208
+
209
+
210
+
211
+ $grid.infiniteScroll({
212
+
213
+ path: getPenPath,
214
+
215
+ append: '.grid__item',
216
+
217
+ outlayer: msnry,
218
+
219
+ status: '.page-load-status',
220
+
221
+ });
222
+
223
+ </script>
224
+
225
+ <title></title>
226
+
227
+ </head>
228
+
229
+ <body>
230
+
231
+ <h1>Infinite Scroll - Masonry image grid</h1>
232
+
233
+ <div class="grid are-images-loaded">
234
+
235
+ <div class="grid__col-sizer"></div>
236
+
237
+ <div class="grid__gutter-sizer"></div>
238
+
239
+ <div class="grid__item grid__item--height2"></div>
240
+
241
+ <div class="grid__item grid__item--width2"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/orange-tree.jpg" alt="orange tree"> </div>
242
+
243
+ <div class="grid__item grid__item--height3"></div>
244
+
245
+ <div class="grid__item grid__item--height1"></div>
246
+
247
+ <div class="grid__item grid__item--height2"></div>
248
+
249
+ <div class="grid__item"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/look-out.jpg" alt="look out"> </div>
250
+
251
+ <div class="grid__item grid__item--height1"></div>
252
+
253
+ <div class="grid__item grid__item--height3"></div>
254
+
255
+ <div class="grid__item grid__item--height1"></div>
256
+
257
+ <div class="grid__item grid__item--height3"></div>
258
+
259
+ <div class="grid__item grid__item--height1"></div>
260
+
261
+ <div class="grid__item grid__item--height1"></div>
262
+
263
+ <div class="grid__item grid__item--width2"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/82/raspberries.jpg" alt="rasberries"> </div>
264
+
265
+ <div class="grid__item grid__item--height2"></div>
266
+
267
+ <div class="grid__item grid__item--height2"></div>
268
+
269
+ <div class="grid__item grid__item--height3"></div>
270
+
271
+ <div class="grid__item grid__item--height1"></div>
272
+
273
+ <div class="grid__item grid__item--height2"></div>
274
+
275
+ </div>
276
+
277
+ <div class="page-load-status">
278
+
279
+ <div class="loader-ellips infinite-scroll-request"><span class="loader-ellips__dot"></span><span class="loader-ellips__dot"></span><span class="loader-ellips__dot"></span><span class="loader-ellips__dot"></span></div>
280
+
281
+ <p class="infinite-scroll-last">End of content</p>
282
+
283
+ <p class="infinite-scroll-error">No more pages to load</p>
284
+
285
+ </div>
286
+
287
+ </body>
288
+
289
+ </html>
290
+
291
+ ```
292
+
293
+ とりあえずはまずHTMLからお見せしました。
294
+
295
+ これを実行すると'masonry'プロパティまたはメソッドをサポートしていませんと出ます。
296
+
297
+ できたことは、画像がきちんと整列したわけじゃないですが、ランダムに出てきた事です。
298
+
299
+ 因みにログはビルダーなのででてきません。