質問編集履歴

1

部分解決

2018/07/02 11:50

投稿

ymatt
ymatt

スコア20

test CHANGED
@@ -1 +1 @@
1
- Routing Error
1
+ rails x jquery 画像が表示されない
test CHANGED
@@ -6,252 +6,226 @@
6
6
 
7
7
  このテンプレートを使って簡単なウェブサイトを作ろうと思っています。
8
8
 
9
+ ただ、Carouselの画像が表示されないのと、本来5本であるべき下部のバーが10本表示されています。
10
+
11
+ ![イメージ説明](56ac48de2210e720c01be530b8fdd33f.png)
12
+
9
13
 
10
14
 
11
15
  ### エラーメッセージ
12
16
 
13
17
 
14
18
 
19
+ なし
20
+
21
+
22
+
23
+ ### 該当コード
24
+
25
+
26
+
27
+ ```ここに言語を入力
28
+
29
+ var introCarousel = $(".carousel");
30
+
31
+ var introCarouselIndicators = $(".carousel-indicators");
32
+
33
+ introCarousel.find(".carousel-inner").children(".carousel-item").each(function(index) {
34
+
35
+ (index === 0) ?
36
+
37
+ introCarouselIndicators.append("<li data-target='#introCarousel' data-slide-to='" + index + "' class='active'></li>") :
38
+
39
+ introCarouselIndicators.append("<li data-target='#introCarousel' data-slide-to='" + index + "'></li>");
40
+
41
+
42
+
43
+ $(this).css("background-image", "asset-path('" + $(this).children('.carousel-background').children('img').attr('src') +"')");
44
+
45
+ $(this).children('.carousel-background').remove();
46
+
47
+ });
48
+
49
+
50
+
51
+ $(".carousel").swipe({
52
+
53
+ swipe: function(event, direction, distance, duration, fingerCount, fingerData) {
54
+
55
+ if (direction == 'left') $(this).carousel('next');
56
+
57
+ if (direction == 'right') $(this).carousel('prev');
58
+
59
+ },
60
+
61
+ allowPageScroll:"vertical"
62
+
63
+ });
64
+
15
65
  ```
16
66
 
17
- Started GET "/img/call-to-action-bg.jpg" for ::1 at 2018-06-13 22:15:10 +0800
18
-
19
-
20
-
21
- ActionController::RoutingError (No route matches [GET] "/img/call-to-action-bg.jpg"):
22
-
23
- actionpack (4.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
24
-
25
- web-console (2.3.0) lib/web_console/middleware.rb:28:in `block in call'
26
-
27
- web-console (2.3.0) lib/web_console/middleware.rb:18:in `catch'
28
-
29
- web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
30
-
31
- actionpack (4.2.6) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
32
-
33
- railties (4.2.6) lib/rails/rack/logger.rb:38:in `call_app'
34
-
35
- railties (4.2.6) lib/rails/rack/logger.rb:20:in `block in call'
36
-
37
- activesupport (4.2.6) lib/active_support/tagged_logging.rb:68:in `block in tagged'
38
-
39
- activesupport (4.2.6) lib/active_support/tagged_logging.rb:26:in `tagged'
40
-
41
- activesupport (4.2.6) lib/active_support/tagged_logging.rb:68:in `tagged'
42
-
43
- railties (4.2.6) lib/rails/rack/logger.rb:20:in `call'
44
-
45
- actionpack (4.2.6) lib/action_dispatch/middleware/request_id.rb:21:in `call'
46
-
47
- rack (1.6.10) lib/rack/methodoverride.rb:22:in `call'
48
-
49
- rack (1.6.10) lib/rack/runtime.rb:18:in `call'
50
-
51
- activesupport (4.2.6) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
52
-
53
- rack (1.6.10) lib/rack/lock.rb:17:in `call'
54
-
55
- actionpack (4.2.6) lib/action_dispatch/middleware/static.rb:120:in `call'
56
-
57
- rack (1.6.10) lib/rack/sendfile.rb:113:in `call'
58
-
59
- railties (4.2.6) lib/rails/engine.rb:518:in `call'
60
-
61
- railties (4.2.6) lib/rails/application.rb:165:in `call'
62
-
63
- rack (1.6.10) lib/rack/lock.rb:17:in `call'
64
-
65
- rack (1.6.10) lib/rack/content_length.rb:15:in `call'
66
-
67
- rack (1.6.10) lib/rack/handler/webrick.rb:88:in `service'
68
-
69
- /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
70
-
71
- /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
72
-
73
- /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
74
-
75
-
76
-
77
-
78
-
79
- Rendered /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (7.5ms)
80
-
81
- Rendered /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/routes/_route.html.erb (1.7ms)
82
-
83
- Rendered /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/routes/_table.html.erb (2.9ms)
84
-
85
- Rendered /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_request_and_response.html.erb (4.6ms)
86
-
87
- Rendered /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/routing_error.html.erb within rescues/layout (318.1ms)
88
-
89
- Rendered /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/web-console-2.3.0/lib/web_console/templates/_markup.html.erb (0.5ms)
90
-
91
- Rendered /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/web-console-2.3.0/lib/web_console/templates/_inner_console_markup.html.erb within layouts/inlined_string (0.6ms)
92
-
93
- Rendered /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/web-console-2.3.0/lib/web_console/templates/_prompt_box_markup.html.erb within layouts/inlined_string (0.5ms)
94
-
95
- Rendered /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/web-console-2.3.0/lib/web_console/templates/style.css.erb within layouts/inlined_string (0.6ms)
96
-
97
- Rendered /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/web-console-2.3.0/lib/web_console/templates/console.js.erb within layouts/javascript (132.4ms)
98
-
99
- Rendered /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/web-console-2.3.0/lib/web_console/templates/main.js.erb within layouts/javascript (0.6ms)
100
-
101
- Rendered /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/web-console-2.3.0/lib/web_console/templates/error_page.js.erb within layouts/javascript (0.7ms)
102
-
103
- Rendered /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/web-console-2.3.0/lib/web_console/templates/index.html.erb (296.1ms)
104
-
105
-
106
-
107
-
108
-
109
- Started GET "/images/lightbox/close.png" for ::1 at 2018-06-13 22:15:11 +0800
110
-
111
-
112
-
113
- ActionController::RoutingError (No route matches [GET] "/images/lightbox/close.png"):
114
-
115
- actionpack (4.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
116
-
117
- web-console (2.3.0) lib/web_console/middleware.rb:28:in `block in call'
118
-
119
- web-console (2.3.0) lib/web_console/middleware.rb:18:in `catch'
120
-
121
- web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
122
-
123
- actionpack (4.2.6) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
124
-
125
- railties (4.2.6) lib/rails/rack/logger.rb:38:in `call_app'
126
-
127
- railties (4.2.6) lib/rails/rack/logger.rb:20:in `block in call'
128
-
129
- activesupport (4.2.6) lib/active_support/tagged_logging.rb:68:in `block in tagged'
130
-
131
- activesupport (4.2.6) lib/active_support/tagged_logging.rb:26:in `tagged'
132
-
133
- activesupport (4.2.6) lib/active_support/tagged_logging.rb:68:in `tagged'
134
-
135
- railties (4.2.6) lib/rails/rack/logger.rb:20:in `call'
136
-
137
- actionpack (4.2.6) lib/action_dispatch/middleware/request_id.rb:21:in `call'
138
-
139
- rack (1.6.10) lib/rack/methodoverride.rb:22:in `call'
140
-
141
- rack (1.6.10) lib/rack/runtime.rb:18:in `call'
142
-
143
- activesupport (4.2.6) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
144
-
145
- rack (1.6.10) lib/rack/lock.rb:17:in `call'
146
-
147
- actionpack (4.2.6) lib/action_dispatch/middleware/static.rb:120:in `call'
148
-
149
- rack (1.6.10) lib/rack/sendfile.rb:113:in `call'
150
-
151
- railties (4.2.6) lib/rails/engine.rb:518:in `call'
152
-
153
- railties (4.2.6) lib/rails/application.rb:165:in `call'
154
-
155
- rack (1.6.10) lib/rack/lock.rb:17:in `call'
156
-
157
- rack (1.6.10) lib/rack/content_length.rb:15:in `call'
158
-
159
- rack (1.6.10) lib/rack/handler/webrick.rb:88:in `service'
160
-
161
- /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
162
-
163
- /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
164
-
165
- /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
166
-
167
-
168
-
169
-
170
-
171
- Rendered /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (2.1ms)
172
-
173
- (中略)
174
-
175
- Rendered /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/web-console-2.3.0/lib/web_console/templates/index.html.erb (299.6ms)
176
-
177
-
178
-
179
-
180
-
181
- Started GET "/undefined" for ::1 at 2018-06-13 22:15:14 +0800
182
-
183
-
184
-
185
- ActionController::RoutingError (No route matches [GET] "/undefined"):
186
-
187
- actionpack (4.2.6) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
188
-
189
- web-console (2.3.0) lib/web_console/middleware.rb:28:in `block in call'
190
-
191
- web-console (2.3.0) lib/web_console/middleware.rb:18:in `catch'
192
-
193
- web-console (2.3.0) lib/web_console/middleware.rb:18:in `call'
194
-
195
- actionpack (4.2.6) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
196
-
197
- railties (4.2.6) lib/rails/rack/logger.rb:38:in `call_app'
198
-
199
- railties (4.2.6) lib/rails/rack/logger.rb:20:in `block in call'
200
-
201
- activesupport (4.2.6) lib/active_support/tagged_logging.rb:68:in `block in tagged'
202
-
203
- activesupport (4.2.6) lib/active_support/tagged_logging.rb:26:in `tagged'
204
-
205
- activesupport (4.2.6) lib/active_support/tagged_logging.rb:68:in `tagged'
206
-
207
- railties (4.2.6) lib/rails/rack/logger.rb:20:in `call'
208
-
209
- actionpack (4.2.6) lib/action_dispatch/middleware/request_id.rb:21:in `call'
210
-
211
- rack (1.6.10) lib/rack/methodoverride.rb:22:in `call'
212
-
213
- rack (1.6.10) lib/rack/runtime.rb:18:in `call'
214
-
215
- activesupport (4.2.6) lib/active_support/cache/strategy/local_cache_middleware.rb:28:in `call'
216
-
217
- rack (1.6.10) lib/rack/lock.rb:17:in `call'
218
-
219
- actionpack (4.2.6) lib/action_dispatch/middleware/static.rb:120:in `call'
220
-
221
- rack (1.6.10) lib/rack/sendfile.rb:113:in `call'
222
-
223
- railties (4.2.6) lib/rails/engine.rb:518:in `call'
224
-
225
- railties (4.2.6) lib/rails/application.rb:165:in `call'
226
-
227
- rack (1.6.10) lib/rack/lock.rb:17:in `call'
228
-
229
- rack (1.6.10) lib/rack/content_length.rb:15:in `call'
230
-
231
- rack (1.6.10) lib/rack/handler/webrick.rb:88:in `service'
232
-
233
- /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/2.3.0/webrick/httpserver.rb:140:in `service'
234
-
235
- /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/2.3.0/webrick/httpserver.rb:96:in `run'
236
-
237
- /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/2.3.0/webrick/server.rb:296:in `block in start_thread'
238
-
239
-
240
-
241
-
242
-
243
- Rendered /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/actionpack-4.2.6/lib/action_dispatch/middleware/templates/rescues/_trace.html.erb (2.6ms)
244
-
245
- (中略)
246
-
247
- Rendered /Users/ytktw/.rbenv/versions/2.3.1/lib/ruby/gems/2.3.0/gems/web-console-2.3.0/lib/web_console/templates/index.html.erb (190.6ms)
67
+ ```ここに言語を入力
68
+
69
+ <section id="intro">
70
+
71
+ <div class="intro-container">
72
+
73
+ <div id="introCarousel" class="carousel slide carousel-fade" data-ride="carousel">
74
+
75
+
76
+
77
+ <ol class="carousel-indicators"></ol>
78
+
79
+
80
+
81
+ <div class="carousel-inner" role="listbox">
82
+
83
+
84
+
85
+ <div class="carousel-item active">
86
+
87
+ <div class="carousel-background"><img src="assets/intro-carousel/1.jpg" alt=""></div>
88
+
89
+ <div class="carousel-container">
90
+
91
+ <div class="carousel-content">
92
+
93
+ <h2>We are professional</h2>
94
+
95
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
96
+
97
+ <a href="#featured-services" class="btn-get-started scrollto">Get Started</a>
98
+
99
+ </div>
100
+
101
+ </div>
102
+
103
+ </div>
104
+
105
+
106
+
107
+ <div class="carousel-item">
108
+
109
+ <div class="carousel-background"><img src="assets/intro-carousel/2.jpg" alt=""></div>
110
+
111
+ <div class="carousel-container">
112
+
113
+ <div class="carousel-content">
114
+
115
+ <h2>At vero eos et accusamus</h2>
116
+
117
+ <p>Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut.</p>
118
+
119
+ <a href="#featured-services" class="btn-get-started scrollto">Get Started</a>
120
+
121
+ </div>
122
+
123
+ </div>
124
+
125
+ </div>
126
+
127
+
128
+
129
+ <div class="carousel-item">
130
+
131
+ <div class="carousel-background"><img src="assets/intro-carousel/3.jpg" alt=""></div>
132
+
133
+ <div class="carousel-container">
134
+
135
+ <div class="carousel-content">
136
+
137
+ <h2>Temporibus autem quibusdam</h2>
138
+
139
+ <p>Beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt omnis iste natus error sit voluptatem accusantium.</p>
140
+
141
+ <a href="#featured-services" class="btn-get-started scrollto">Get Started</a>
142
+
143
+ </div>
144
+
145
+ </div>
146
+
147
+ </div>
148
+
149
+
150
+
151
+ <div class="carousel-item">
152
+
153
+ <div class="carousel-background"><img src="assets/intro-carousel/4.jpg" alt=""></div>
154
+
155
+ <div class="carousel-container">
156
+
157
+ <div class="carousel-content">
158
+
159
+ <h2>Nam libero tempore</h2>
160
+
161
+ <p>Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum.</p>
162
+
163
+ <a href="#featured-services" class="btn-get-started scrollto">Get Started</a>
164
+
165
+ </div>
166
+
167
+ </div>
168
+
169
+ </div>
170
+
171
+
172
+
173
+ <div class="carousel-item">
174
+
175
+ <div class="carousel-background"><img src="assets/intro-carousel/5.jpg" alt=""></div>
176
+
177
+ <div class="carousel-container">
178
+
179
+ <div class="carousel-content">
180
+
181
+ <h2>Magnam aliquam quaerat</h2>
182
+
183
+ <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
184
+
185
+ <a href="#featured-services" class="btn-get-started scrollto">Get Started</a>
186
+
187
+ </div>
188
+
189
+ </div>
190
+
191
+ </div>
192
+
193
+
194
+
195
+ </div>
196
+
197
+
198
+
199
+ <a class="carousel-control-prev" href="#introCarousel" role="button" data-slide="prev">
200
+
201
+ <span class="carousel-control-prev-icon ion-chevron-left" aria-hidden="true"></span>
202
+
203
+ <span class="sr-only">Previous</span>
204
+
205
+ </a>
206
+
207
+
208
+
209
+ <a class="carousel-control-next" href="#introCarousel" role="button" data-slide="next">
210
+
211
+ <span class="carousel-control-next-icon ion-chevron-right" aria-hidden="true"></span>
212
+
213
+ <span class="sr-only">Next</span>
214
+
215
+ </a>
216
+
217
+
218
+
219
+ </div>
220
+
221
+ </div>
222
+
223
+ </section>
248
224
 
249
225
  ```
250
226
 
251
-
252
-
253
- ### 該当コード
254
-
255
-
256
-
257
- 奇妙なことに、該当するードがありません。エラーを起こしているルーティグでファイル検索をしても、ヒットしません。htmlファイル等に記載あるルーティングはRailsがよみ込めるように変更してあ、正常に動作しています。
227
+ $(this).children('.carousel-background').remove();をントアウトたところ画像は表示されしたが、width 100%cssあたらなくなってしまったように、ブラウザよも幅が広く表示されます。
228
+
229
+
230
+
231
+ どなたか解決法をご教示いただけますでしょうか。よろしくお願いいたします。