質問編集履歴
1
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,269 +1,3 @@
|
|
1
|
-
### 前提・実現したいこと
|
2
|
-
|
3
|
-
投稿された画像を(eachされた)スライドショーで表示させたい
|
4
|
-
|
5
|
-
https://bkosborne.com/jquery-waterwheel-carouselを参考にコードをダウンロードしてきて
|
6
|
-
|
7
|
-
画像部分をアレンジして作成しました。
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
### 発生している問題・エラーメッセージ
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
```
|
16
|
-
|
17
|
-
画像が表示されません。
|
18
|
-
|
19
|
-
しかし検証してみると小さく表示があるのですが透明であるのかがわかりません。
|
20
|
-
|
21
|
-
```
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
![イメージ説明](2d212b63cec083ece4efcccb90331162.png)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
![イメージ説明](0ea6dde98437f42d3b2e8609263c54ee.png)
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
### 該当のソースコード
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
```HTML
|
38
|
-
|
39
|
-
<h1>Carousel Demo</h1>
|
40
|
-
|
41
|
-
<div id="carousel">
|
42
|
-
|
43
|
-
<% @products.each do |product| %>
|
44
|
-
|
45
|
-
!!! この部分でID名を取得しています。!!!
|
46
|
-
|
47
|
-
<script type="text/javascript">
|
48
|
-
|
49
|
-
$(function(){
|
50
|
-
|
51
|
-
$('img').each(function(i){
|
52
|
-
|
53
|
-
$(this).attr('id','item-' + (i+1) );
|
54
|
-
|
55
|
-
});
|
56
|
-
|
57
|
-
});
|
58
|
-
|
59
|
-
</script>
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
<a href="#"><%= attachment_image_tag product, :image %></a>
|
64
|
-
|
65
|
-
<% end %>
|
66
|
-
|
67
|
-
</div>
|
68
|
-
|
69
|
-
<a href="#" id="prev">Prev</a> | <a href="#" id="next">Next</a>
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
```
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
```CSS
|
82
|
-
|
83
|
-
body {
|
84
|
-
|
85
|
-
font-family:Arial;
|
86
|
-
|
87
|
-
font-size:12px;
|
88
|
-
|
89
|
-
background:#ededed;
|
90
|
-
|
91
|
-
}
|
92
|
-
|
93
|
-
.example-desc {
|
94
|
-
|
95
|
-
margin:3px 0;
|
96
|
-
|
97
|
-
padding:5px;
|
98
|
-
|
99
|
-
}
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
#carousel {
|
104
|
-
|
105
|
-
width:960px;
|
106
|
-
|
107
|
-
border:1px solid #222;
|
108
|
-
|
109
|
-
height:300px;
|
110
|
-
|
111
|
-
position:relative;
|
112
|
-
|
113
|
-
clear:both;
|
114
|
-
|
115
|
-
overflow:hidden;
|
116
|
-
|
117
|
-
background:#FFF;
|
118
|
-
|
119
|
-
}
|
120
|
-
|
121
|
-
#carousel img {
|
122
|
-
|
123
|
-
visibility:hidden; /* hide images until carousel can handle them */
|
124
|
-
|
125
|
-
cursor:pointer; /* otherwise it's not as obvious items can be clicked */
|
126
|
-
|
127
|
-
}
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
.split-left {
|
132
|
-
|
133
|
-
width:450px;
|
134
|
-
|
135
|
-
float:left;
|
136
|
-
|
137
|
-
}
|
138
|
-
|
139
|
-
.split-right {
|
140
|
-
|
141
|
-
width:400px;
|
142
|
-
|
143
|
-
float:left;
|
144
|
-
|
145
|
-
margin-left:10px;
|
146
|
-
|
147
|
-
}
|
148
|
-
|
149
|
-
#callback-output {
|
150
|
-
|
151
|
-
height:250px;
|
152
|
-
|
153
|
-
overflow:scroll;
|
154
|
-
|
155
|
-
}
|
156
|
-
|
157
|
-
textarea#newoptions {
|
158
|
-
|
159
|
-
width:430px;
|
160
|
-
|
161
|
-
}
|
162
|
-
|
163
|
-
```
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
```javascript
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
<script type="text/javascript">
|
172
|
-
|
173
|
-
$(document).ready(function () {
|
174
|
-
|
175
|
-
var carousel = $("#carousel").waterwheelCarousel({
|
176
|
-
|
177
|
-
flankingItems: 3,
|
178
|
-
|
179
|
-
movingToCenter: function ($item) {
|
180
|
-
|
181
|
-
$('#callback-output').prepend('movingToCenter: ' + $item.attr('id') + '<br/>');
|
182
|
-
|
183
|
-
},
|
184
|
-
|
185
|
-
movedToCenter: function ($item) {
|
186
|
-
|
187
|
-
$('#callback-output').prepend('movedToCenter: ' + $item.attr('id') + '<br/>');
|
188
|
-
|
189
|
-
},
|
190
|
-
|
191
|
-
movingFromCenter: function ($item) {
|
192
|
-
|
193
|
-
$('#callback-output').prepend('movingFromCenter: ' + $item.attr('id') + '<br/>');
|
194
|
-
|
195
|
-
},
|
196
|
-
|
197
|
-
movedFromCenter: function ($item) {
|
198
|
-
|
199
|
-
$('#callback-output').prepend('movedFromCenter: ' + $item.attr('id') + '<br/>');
|
200
|
-
|
201
|
-
},
|
202
|
-
|
203
|
-
clickedCenter: function ($item) {
|
204
|
-
|
205
|
-
$('#callback-output').prepend('clickedCenter: ' + $item.attr('id') + '<br/>');
|
206
|
-
|
207
|
-
}
|
208
|
-
|
209
|
-
});
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
$('#prev').bind('click', function () {
|
214
|
-
|
215
|
-
carousel.prev();
|
216
|
-
|
217
|
-
return false
|
218
|
-
|
219
|
-
});
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
$('#next').bind('click', function () {
|
224
|
-
|
225
|
-
carousel.next();
|
226
|
-
|
227
|
-
return false;
|
228
|
-
|
229
|
-
});
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
$('#reload').bind('click', function () {
|
234
|
-
|
235
|
-
newOptions = eval("(" + $('#newoptions').val() + ")");
|
236
|
-
|
237
|
-
carousel.reload(newOptions);
|
238
|
-
|
239
|
-
return false;
|
240
|
-
|
241
|
-
});
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
});
|
246
|
-
|
247
|
-
</script>
|
248
|
-
|
249
|
-
```
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
```
|
254
|
-
|
255
|
-
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
|
256
|
-
|
257
|
-
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
|
258
|
-
|
259
|
-
<script type="text/javascript" src="/jquery.waterwheelCarousel.min.js"></script>
|
260
|
-
|
261
|
-
<script type="text/javascript" src="http://code.jquery.com/jquery-3.3.1.min.js"></script>
|
262
|
-
|
263
|
-
<script type="text/javascript" src="js/jquery.waterwheelCarousel.js"></script>
|
264
|
-
|
265
|
-
```
|
266
|
-
|
267
1
|
### 試したこと
|
268
2
|
|
269
3
|
http://code.jquery.com/jquery-1.9.1.min.js
|