質問編集履歴

3

追記

2017/03/24 10:19

投稿

sssooo
sssooo

スコア17

test CHANGED
File without changes
test CHANGED
@@ -443,3 +443,47 @@
443
443
  </html>
444
444
 
445
445
  ```
446
+
447
+ ###追記
448
+
449
+ ```JavaScript
450
+
451
+ j(".modal-open").click(function(){
452
+
453
+
454
+
455
+ //モーダル表示部分
456
+
457
+ .....
458
+
459
+
460
+
461
+ //ページネーション
462
+
463
+ var target = $(this);
464
+
465
+ $('#next').click(function(){
466
+
467
+ var next = target.next();
468
+
469
+ if (next.length === 0) next = target.siblings().eq(0);
470
+
471
+ resetModal();
472
+
473
+ $('#image').append(next.data('content'));
474
+
475
+ $('#title').text(next.data('title'));
476
+
477
+ $('#disc-top').text(next.data('disc-top'));
478
+
479
+ $('#disc-bottom').text(next.data('disc-bottom'));
480
+
481
+ });
482
+
483
+
484
+
485
+ });
486
+
487
+ ```
488
+
489
+ これで次のコンテンツが一度だけ表示されるようになりました。これを投稿数分回すためにfor文で囲ったりtargetの値を上書きする必要があるような気がするのですが、如何様にすべきでしょうか?スキルが追いつかず申し訳ありません。

2

コード追記

2017/03/24 10:19

投稿

sssooo
sssooo

スコア17

test CHANGED
File without changes
test CHANGED
@@ -186,6 +186,260 @@
186
186
 
187
187
  <?php get_footer();
188
188
 
189
+
190
+
189
191
  ```
190
192
 
193
+ ```JavaScript
194
+
195
+ $(function(){
196
+
197
+
198
+
199
+ $(".modal-open").click(function(){
200
+
201
+ $( this ).blur();
202
+
203
+ if( $( "#modal-overlay" )[0] ) return false;
204
+
205
+ $( "body" ).append( '<div id="modal-overlay"></div>' );
206
+
207
+ $( "#modal-overlay" ).fadeIn() ;
208
+
209
+ centeringModalSyncer() ;
210
+
211
+ $( "#modal-content" ).fadeIn() ;
212
+
213
+ $('#image').append($(this).data('content'));
214
+
215
+ $('#title').text($(this).data('title'));
216
+
217
+ $('#disc-top').text($(this).data('disc-top'));
218
+
219
+ $('#disc-bottom').text($(this).data('disc-bottom'));
220
+
221
+ $( "#modal-overlay, #modal-close" ).unbind().click( function(){
222
+
223
+ $( "#modal-content, #modal-overlay" ).fadeOut(function(){
224
+
191
- CSS/JSは長くなるので割愛しますが、必要があれば追記します。
225
+ $('#modal-overlay').remove() ;
226
+
227
+ resetModal();
228
+
229
+ }) ;
230
+
231
+ }) ;
232
+
233
+ }) ;
234
+
235
+
236
+
237
+ ( window ).resize( centeringModalSyncer ) ;
238
+
239
+ function centeringModalSyncer() {
240
+
241
+ var wid = $( window ).width() ;
242
+
243
+ var hei = $( window ).height() ;
244
+
245
+ var cw = $( "#modal-content" ).outerWidth( {margin:true} );
246
+
247
+ var ch = $( "#modal-content" ).outerHeight( {margin:true} );
248
+
249
+ var cw = $( "#modal-content" ).outerWidth();
250
+
251
+ var ch = $( "#modal-content" ).outerHeight();
252
+
253
+ $( "#modal-content" ).css( {"left": ((wid - cw)/2) + "px","top": ((hei - ch)/2) + "px"} ) ;
254
+
255
+ }
256
+
257
+
258
+
259
+ function resetModal(){
260
+
261
+ $('#image').empty();
262
+
263
+ $('#title').text('');
264
+
265
+ $('#disc-top').text('');
266
+
267
+ $('#disc-bottom').text('');
268
+
269
+ }
270
+
271
+ ```
272
+
273
+ ```HTML
274
+
275
+
276
+
277
+ <body>
278
+
279
+
280
+
281
+ <div class="container">
282
+
283
+ <div class="row">
284
+
285
+ <header>ヘッダー</header>
286
+
287
+ </div>
288
+
289
+
290
+
291
+ <div class="row clearfix">
292
+
293
+ <div class="content">
294
+
295
+
296
+
297
+ <div id="modal-content">
298
+
299
+ <div id="modal-content-inner">
300
+
301
+ <p><a id="modal-close" class="close">
302
+
303
+ <svg></svg>
304
+
305
+ </a></p>
306
+
307
+ <div id="image">
308
+
309
+ <img src="" alt=""> //投稿コンテンツを表示
310
+
311
+ </div>
312
+
313
+ <div id="caption">
314
+
315
+ <div id="title">
316
+
317
+ <p>タイトル</p> //投稿タイトルを表示
318
+
319
+ </div>
320
+
321
+ <div id="disc">
322
+
323
+ <p id="disc-top">値1</p> //投稿カスタムフィールド値を表示
324
+
325
+ <p id="disc-bottom">値2</p> //投稿カスタムフィールド値を表示
326
+
327
+ </div>
328
+
329
+ </div>
330
+
331
+ <div class="pager">
332
+
333
+ <p><a class="prev">
334
+
335
+ <svg viewbox="0 0 180 310" width="15" height="20">
336
+
337
+ <path d="M170 10 L10 161 M10 150 L170 300">
338
+
339
+ </svg>
340
+
341
+ </a></p>
342
+
343
+ <p><a class="next">
344
+
345
+ <svg viewbox="0 0 180 310" width="15" height="20">
346
+
347
+ <path d="M10 10 L170 161 M170 150 L10 300">
348
+
349
+ </svg>
350
+
351
+ </a></p>
352
+
353
+ </div>
354
+
355
+ </div>
356
+
357
+ </div>
358
+
359
+
360
+
361
+ <article>
362
+
363
+ <div class="wrap">
364
+
365
+ <section>
366
+
367
+ <div class="works-section">
368
+
369
+ <div class="year">
370
+
371
+ <h3>2016</h3> //子カテゴリーtitle
372
+
373
+ </div>
374
+
375
+ <div class="images">
376
+
377
+ <div class="modal-open trim"><img src="" alt=""></div>
378
+
379
+ .... //投稿コンテンツ
380
+
381
+ </div>
382
+
383
+ </div>
384
+
385
+ </section>
386
+
387
+
388
+
389
+ <section>
390
+
391
+ <div class="works-section">
392
+
393
+ <div class="year">
394
+
395
+ <h3>2015</h3> //子カテゴリーtitle
396
+
397
+ </div>
398
+
399
+ <div class="images">
400
+
401
+ <div class="modal-open trim"><img src="" alt=""></div>
402
+
403
+ .... //投稿コンテンツ
404
+
405
+ </div>
406
+
407
+ </div>
408
+
409
+ </section>
410
+
411
+
412
+
413
+ </div>
414
+
415
+
416
+
417
+ </article>
418
+
419
+
420
+
421
+ </div>
422
+
423
+
424
+
425
+ </div>
426
+
427
+
428
+
429
+ <footer>フッター</footer>
430
+
431
+
432
+
433
+ </div>
434
+
435
+
436
+
437
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
438
+
439
+ <script type="text/javascript" src="js/script.js"></script>
440
+
441
+ </body>
442
+
443
+ </html>
444
+
445
+ ```

1

タイトル編集

2017/03/23 22:47

投稿

sssooo
sssooo

スコア17

test CHANGED
@@ -1 +1 @@
1
- 【Wordpress】モーダルウィンドウ上でのページネーション
1
+ モーダルウィンドウ上でのページネーション
test CHANGED
File without changes