我有RoR项目(rails 4.2.1),我正在尝试实现旋转木马。它主要起作用:所有图像以正确的顺序和设定的时间间隔出现,但没有滑动,转换到下一个图像的glyphicon-chevron-right
箭头比前一个图像的左箭头小得多。 / p>
我正在使用来自MaxCDN的缩小的3.3.7引导程序文件,并且正在加载JQuery。对于glyphicon-chevron-right
问题,我尝试通过CSS增加字体大小,但这不起作用。我也试过使用其他字形,但它们在旋转木马中奇怪地定位,我无法正确定位它们。
以下是我现在所使用的轮播代码(改编自here):
<%if @firstimg.present?%>
<div class="col-md-offset-3 col-md-6">
<div id="carousel-example-generic" class="carousel slide container" data-ride="carousel" data-pause="hover" style="height:200px;margin-right:auto;margin-left:auto">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<%if @slideshow.size > 0%>
<% for i in 1..@slideshow.size%>
<li data-target="#carousel-example-generic" data-slide-to=<%=i%>></li>
<%end%>
<%end%>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
<div class="item active">
<img src=<%=@firstimg%> alt=<%=@modulo.nome%>>
</div>
<%if @slideshow.size > 0%>
<%@slideshow.each do |s|%>
<div class="item">
<img src=<%=s.photo.url%> alt=<%=@modulo.nome%>>
</div>
<%end%>
<%end%>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Anterior</span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Próximo</span>
</a>
</div>
</div>
<%end%>
相关的CSS:
.carousel-inner > .item > img {
margin: 0 auto;
}
.carousel {
width:100%;
background-color: #b3b3b3;
height:200px;
margin-right:auto;
margin-left:auto;
}
编辑:控制器:
def saiba_mais
@preco = preco_modulo(@modulo.id)
@firstimg = @modulo.images.first.photo.url
@slideshow = @modulo.images.drop(1)
end