我正在尝试使用 twitter-bootstrap 在 Rails 应用程序中设置 Nivo Slider,我面临的问题是图像出现在另一个不滑动的顶部,知道如何解决这个问题吗?
这是我的代码:
加载 nivo 滑块:
<div class="slider-wrapper theme-default">
<div id="slider" class="nivoSlider">
<% @page.images.each_with_index do |img, index| %>
<%= image_tag img.url, :title => '#htmlcaption' %>
</div>
</div>
<div id="htmlcaption" class="nivo-html-caption">
<%=raw @page.caption_for_image_index(index) %>
</div>
<% end %>
_javascript.html.erb
<%= javascript_include_tag 'application' %>
<%= javascript_include_tag 'jquery.nivo.slider.pack' %>
<%= javascript_include_tag 'jquery.nivo.slider' %>
<script type="text/javascript">
$(window).load(function() {
$('#slider').nivoSlider({
effect: 'fade',
pauseTime: 5000,
directionNav:true,
controlNav:true
});
});
</script>
应用程序.js
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require bootstrap