Denys Medynskyi
Denys Medynskyi

Reputation: 2353

Carousel didn't start cycle onload

Problem is in title.

My html:

   <div id="myCarousel" class="carousel">
    <div class="carousel-inner">
      <div class="active item"><%=  image_tag("/images/home_page_1.png")%></div>
      <div class="item"><%= image_tag("/images/home_page_2.png", :size => '600x260') %></div>
      <div class="item"><%= image_tag("/images/home_page_3.png", :size => '600x260') %></div>
    </div>
  </div>

My js:

$('#myCarousel').carousel({ interval: 200 }) 

Files are in my js folder. Everthing else working wright. Google chrome gives me error:

Uncaught TypeError: Object [object Object] has no method 'carousel' :3000/assets/application.js?body=1:17

Upvotes: 1

Views: 766

Answers (2)

Kaspar
Kaspar

Reputation: 80

Have you loaded your jquery carousel extension javascript file correctly? Jquery does not have carousel method by default, you have to use extension like http://thomaslanciaux.pro/jquery/jquery_carousel.htm

Upvotes: 0

baptme
baptme

Reputation: 10092

make sure:

  • Only one jQuery is loaded.

  • jQuery is included before bootstrap.js or bootstrap-carousel.js

  • Don't include both bootstrap.js and bootstrap-carousel.js

Upvotes: 2

Related Questions