I am trying to implement the simple bootstrap carousel in my Rails application and use it as a simple tour of my site. It works with one major exception. There is no slide action. It simple changes from one item to the next. Here is my code:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
<body>
<div id="TourCarousel" class="carousel slide" data-ride="carousel">
<ol class="carousel-indicators">
<li data-target="#TourCarousel" data-slide-to="0" class="active"></li>
<li data-target="#TourCarousel" data-slide-to="1"></li>
<li data-target="#TourCarousel" data-slide-to="2"></li>
</ol>
<div class="carousel-inner">
<div class="item active">
<img src="" alt="">
<div class="carousel-caption">
<h3>Caption Text 1</h3>
</div>
</div>
<div class="item">
<img src="" alt="">
<div class="carousel-caption">
<h3>Caption Text 2</h3>
</div>
</div>
<div class="item">
<img src="" alt="">
<div class="carousel-caption">
<h3>Caption Text 3</h3>
</div>
</div>
</div>
<a class="left carousel-control" href="#TourCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span></a>
<a class="right carousel-control" href="#TourCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span></a>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('.carousel').carousel();
});
</script>
</body>
</html>
I cannot see why this is not sliding. Its basically cut and pasted from the bootstrap site.
I have seen many questions on this and most lead up to including the script to initiate the carousel:
Bootstrap carousel not sliding
...but I have followed this instruction with no impact on the functionality of the carousel. In addition previous questions haven't looked at this in Rails specifically (not that I can see why this would make a difference).