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

回答編集履歴

1

説明不足

2018/11/06 04:03

投稿

marshmallowy
marshmallowy

スコア204

answer CHANGED
@@ -1,6 +1,39 @@
1
1
  <p>の値を取得して、<a data-title="">と<img alt="">に挿入していきたいです。
2
2
 
3
- ```jQuery
3
+ ```CODE
4
+ <!DOCTYPE html>
5
+ <html lang="ja">
6
+ <head>
7
+ <meta charset="UTF-8">
8
+ <meta http-equiv="x-ua-compatible" content="ie=edge">
9
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
10
+ <meta name="description" content=""/>
11
+ <title>Title</title>
12
+ </head>
13
+ <body>
14
+ <div class="thumb_area">
15
+ <div class="thumbnail">
16
+ <a href="#" data-lightbox="group">
17
+ <img src="http://satyr.io/400x80">
18
+ </a>
19
+ <p>写真1の説明が入ります。</p>
20
+ </div>
21
+ <div class="thumbnail">
22
+ <a href="#" data-lightbox="group">
23
+ <img src="http://satyr.io/400x80">
24
+ </a>
25
+ <p>写真2の説明が入ります。</p>
26
+ </div>
27
+ <div class="thumbnail">
28
+ <a href="#" data-lightbox="group">
29
+ <img src="http://satyr.io/400x80">
30
+ </a>
31
+ <p>写真3の説明が入ります。</p>
32
+ </div>
33
+ </div>
34
+ <script src="https://code.jquery.com/jquery-3.3.1.js" integrity="sha256-2Kok7MbOyxpgUVvAk/HJ2jigOSYS2auK4Pfzbm7uH60=" crossorigin="anonymous"></script>
35
+
36
+ <script>
4
37
  $(function(){
5
38
 
6
39
  $('.thumbnail p').each(function(index, element) {
@@ -9,4 +42,7 @@
9
42
  });
10
43
 
11
44
  });
45
+ </script>
46
+ </body>
47
+ </html>
12
48
  ```