您好,我想知道如何在页面加载后选择第二项?
例如,Owl Carousel 通常从第一个项目开始,然后在 HTML 结构中显示该项目之后的下一个项目,但是当页面加载时,我希望它在下面的 HTML 中显示第二个项目类:
<div class="full-screen-slider">
<div id="banner-slider-demo-1" class="owl-carousel owl-theme owl-middle-narrow owl-banner-carousel">
<div class="item" style="background:#f0f0f0;background-image:linear-gradient(#e8e8e8,#f0f0f0);position:relative;">
</div>
<div class="item" style="background:#f0f0f0;background-image:linear-gradient(#e8e8e8,#f0f0f0);position:relative;">
</div>
<div class="item" style="background:#f0f0f0;background-image:linear-gradient(#e8e8e8,#f0f0f0);position:relative;">
</div>
</div>
<script type="text/javascript">
jQuery(function($){
$("#banner-slider-demo-1").owlCarousel({stopOnHover: true,pagination: true, autoPlay: false,navigation: false,paginationSpeed : 500,singleItem:true,});
});
</script>
</div>
有什么方法可以用 Owl Carousel 做到这一点吗?
谢谢,尼克
最佳答案
对于 Owl Carousel 2,使用 to.owl.carousel
事件:
carousel.trigger('to.owl.carousel', index);
关于javascript - 选择 'item' 2 on load - Owl Carousel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33450892/