Rails 中的 Bootstrap Carousel 突然停止工作 [英] Bootstrap Carousel in Rails suddenly stopped working

查看:47
本文介绍了Rails 中的 Bootstrap Carousel 突然停止工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

The carousel I had in my rails application was working until a short while ago, now the next and previous buttons don't work. No changes made to this view, or the carousel in the 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"} ›

推荐答案

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

Found that this solution worked for me:

https://stackoverflow.com/questions/9353294/bootstrap-轮播不工作

在我的标题中使用它:

<script>
$(function(){
  $('#myCarousel').carousel();
});
</script>

这篇关于Rails 中的 Bootstrap Carousel 突然停止工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆