将 OwlCarousel 整合到 Rails 应用中
Incorporating OwlCarousel into a Rails app
我一直在努力将 owlCarousel 整合到 rails 应用程序中。我已经使用以下 javascript:
让它工作
$(document).ready(function(){
$('.owl-carousel').owlCarousel();
});
但是,当我尝试更改其中一个参数时,轮播突然完全不工作了。它没有显示在页面上。
$(document).ready(function(){
$('.owl-carousel').owlCarousel({
item : 3
});
});
这是由我的 rails 应用程序生成的 HTML:
<div id="owl-example" class="owl-carousel">
<div class="featured">
<p>
<a href="/shows/bkpa">
<img alt="Sstl1idgz8hcion3dhcf" class="featured-photo" src="/sstl1idgz8hcion3dhcf.jpg" />
<br />
Show title
</a>
</p>
</div>
<div class="featured">
<p>
<a href="/shows/aadfa">
<img alt="Sstl1idgz8hcion3dhcf" class="featured-photo" src="/sstl1idgz8hcion3dhcf.jpg" />
<br />
Show title
</a>
</p>
</div>
</div>
我在参数列表中没有看到 item
?这可能是原因吗?
我看到 items: 3
作为一个选项,如果您想显示单个项目,还有一个 singleItem
选项。
navigation : true, // Show next and prev buttons
slideSpeed : 300,
paginationSpeed : 400,
singleItem:true
我一直在努力将 owlCarousel 整合到 rails 应用程序中。我已经使用以下 javascript:
让它工作$(document).ready(function(){
$('.owl-carousel').owlCarousel();
});
但是,当我尝试更改其中一个参数时,轮播突然完全不工作了。它没有显示在页面上。
$(document).ready(function(){
$('.owl-carousel').owlCarousel({
item : 3
});
});
这是由我的 rails 应用程序生成的 HTML:
<div id="owl-example" class="owl-carousel">
<div class="featured">
<p>
<a href="/shows/bkpa">
<img alt="Sstl1idgz8hcion3dhcf" class="featured-photo" src="/sstl1idgz8hcion3dhcf.jpg" />
<br />
Show title
</a>
</p>
</div>
<div class="featured">
<p>
<a href="/shows/aadfa">
<img alt="Sstl1idgz8hcion3dhcf" class="featured-photo" src="/sstl1idgz8hcion3dhcf.jpg" />
<br />
Show title
</a>
</p>
</div>
</div>
我在参数列表中没有看到 item
?这可能是原因吗?
我看到 items: 3
作为一个选项,如果您想显示单个项目,还有一个 singleItem
选项。
navigation : true, // Show next and prev buttons
slideSpeed : 300,
paginationSpeed : 400,
singleItem:true