2

我在 Rails 应用程序中使用的轮播直到不久前还在工作,现在下一个和上一个按钮不起作用。没有对此视图或 CSS 中的轮播进行任何更改。

这是我的代码:

.carousel.slide#myCarousel
 .carousel-inner
  .active.item
    =image_tag("/assets/1.jpg")
    .carousel-caption
      %h4 Caption
  .item
    =image_tag("/assets/2.jpg")
    .carousel-caption
      %h4 Caption
  .item
    =image_tag("/assets/3.jpg")
    .carousel-caption
      %h4 Caption

 %a.carousel-control.left{"data-slide" => "prev", :href => "#myCarousel"} ‹
 %a.carousel-control.right{"data-slide" => "next", :href => "#myCarousel"} ›
4

1 回答 1

0

发现这个解决方案对我有用:

https://stackoverflow.com/questions/9353294/bootstrap-carousel-not-working

在我的标题中使用了这个:

<script>
$(function(){
  $('#myCarousel').carousel();
});
</script>
于 2012-10-14T18:18:52.757 回答