Getting error: "$(...).carousel is not a function" although I've included JQuery, Bootstrap.min.css and Bootstrap.min.js

Viewed 7245

This question has been asked before and I've searched through each thread. Unfortunately none of them are relatable to my situation.

I am trying to make a multi-slide-carousel, following the codepen here: https://codepen.io/anon/pen/OmZppE

I have, in my <head>, the following linked scripts/CSS

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

So I'm assuming I've correctly included Jquery and Bootstrap (css and js). Yet when I execute this script

$('.multi-item-carousel').carousel({
  interval: false
});

// for every slide in carousel, copy the next slide's item in the slide.
// Do the same for the next, next item.
$('.multi-item-carousel .item').each(function(){
  var next = $(this).next();
  if (!next.length) {
    next = $(this).siblings(':first');
  }
  next.children(':first-child').clone().appendTo($(this));

  if (next.next().length>0) {
    next.next().children(':first-child').clone().appendTo($(this));
  } else {
    $(this).siblings(':first').children(':first-child').clone().appendTo($(this));
  }
});

I am greeted with the error: "Uncaught TypeError: $(...).carousel is not a function"

Thoughts?

edit: forgot html for actual carousel, ignore erb code inside. Irrelevant to question.

<div class="carousel slide multi-item-carousel" id="theCarousel">
    <div class="carousel-inner">
    <% profile.ventures.each_with_index do |v, index| %>
    <% if index == 0 %>
        <div class="item active">
    <% else %>
        <div class="item">
    <% end %>
        <div class="col-xs-4">
        <%= link_to v do %>
           <div class="image-box">
                 <img src="http://placehold.it/600x450" class="thumbnail img-responsive">
                     <div class="image-box-caption">
                        <b>
                      <span class="image-box-text"><%= v.title %></span>
                    </b>
                      </div>
                      <div class="image-box-price">
                        <b><span class="image-box-text" style="color: white;">From $<%= v.price %></span></b>
                      </div>
            </div>
        <% end %>
        </div>
      </div>
     <% end %>
    </div>
    <a class="left carousel-control" href="#theCarousel" data-slide="prev"><i class="glyphicon glyphicon-chevron-left"></i></a>
    <a class="right carousel-control" href="#theCarousel" data-slide="next"><i class="glyphicon glyphicon-chevron-right"></i></a>
  </div>
1 Answers
Related