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

回答編集履歴

2

追記しました

2017/11/25 15:15

投稿

namnium1125
namnium1125

スコア2045

answer CHANGED
@@ -43,4 +43,79 @@
43
43
  <button id="butt">フェードイン</button>
44
44
  </body>
45
45
  </html>
46
+ ```
47
+
48
+ ## 追記
49
+
50
+ 作ってみたので参考にどうぞ。
51
+
52
+ ```html
53
+ <!DOCTYPE html>
54
+ <html>
55
+ <head>
56
+ <meta charset="utf-8">
57
+ <title>fade-in</title>
58
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
59
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />
60
+ <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script>
61
+ <style>
62
+ .carousel-inner {
63
+ padding: 0;
64
+ }
65
+ .carousel-caption {
66
+ bottom: 25%;
67
+ display: none;
68
+ }
69
+ </style>
70
+ <script>
71
+ $(function() {
72
+ $(".carousel-caption").fadeIn();
73
+ $("#carousel-example-generic").on("slide.bs.carousel",function() {
74
+ $(".carousel-caption").fadeOut("fast");
75
+ });
76
+ $("#carousel-example-generic").on("slid.bs.carousel",function() {
77
+ $(".carousel-caption").fadeIn();
78
+ });
79
+ });
80
+ </script>
81
+ </head>
82
+ <body>
83
+ <section class="carousel-size">
84
+ <div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="8000">
85
+ <div class="carousel-inner"><!-- 変更 -->
86
+ <div class="item active">
87
+ <img src="images/slide1.jpg" alt="slide1" width="100%">
88
+ <div class="carousel-caption">
89
+ 古くから、<br>料理する場、<br>暖をとる場として<br>家族の中心に置かれてきた囲炉裏。
90
+ </div>
91
+ </div>
92
+ <div class="item">
93
+ <img src="images/slide2.jpg" alt="slide2" width="100%">
94
+ <div class="carousel-caption">
95
+ 鉄瓶にゆらゆらと立ち上る湯気、<br>時折ぱちぱちと爆ぜる炭を<br>眺めていると、<br>時間がゆっくり、ゆっくりと<br>流れていきます。
96
+ </div>
97
+ </div>
98
+ <div class="item">
99
+ <img src="images/slide3.jpg" alt="slide3" width="100%">
100
+ <div class="carousel-caption">
101
+ 囲炉裏を囲み、<br>家族が心の中から温まる、<br>そんな場所を作りたくて始めました。
102
+ </div>
103
+ </div>
104
+ <div class="item">
105
+ <img src="images/slide4.jpg" alt="slide4" width="100%">
106
+ <div class="carousel-caption">
107
+ 1つ1つ丁寧に作られた囲炉裏は、<br>あなただけの、<br>世界にたった1つの作品となります。<br>是非、囲炉裏の持つ独自な趣を、<br>体感してください。
108
+ </div>
109
+ </div>
110
+ </div>
111
+ <a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
112
+ <span class="glyphicon glyphicon-chevron-left"></span>
113
+ </a>
114
+ <a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
115
+ <span class="glyphicon glyphicon-chevron-right"></span>
116
+ </a>
117
+ </div>
118
+ </section>
119
+ </body>
120
+ </html>
46
121
  ```

1

追記しました

2017/11/25 15:15

投稿

namnium1125
namnium1125

スコア2045

answer CHANGED
@@ -1,9 +1,14 @@
1
1
  CSSが無いんで答えようにも示していただいたコードでは検証しづらいです。
2
2
 
3
- また[要素指定](http://www.detelu.com/blog/2011/11/jquery-selector-traversing/)がおかしいです。
3
+ - [要素指定](http://www.detelu.com/blog/2011/11/jquery-selector-traversing/)がおかしいです。
4
+ この場合`.left carousel-control`ではなく`.left`でいいはずです。
4
5
 
6
+ - `$`をつけ忘れています。またクラスを示す`.`がありません。
5
- この場合`.left carousel-control`ではなく`.left`でいいはずです。
7
+ × : `("carousel-caption").fadeIn();`
8
+ ○ : `$(".carousel-caption").fadeIn();`
6
9
 
10
+
11
+
7
12
  わからないことがあるときは小さいところから出発してはいかがでしょうか?
8
13
 
9
14
  例えば、これくらい小さなhtmlでお試しになってから、提示していただいたコードを改善していけばいいと思います。