我正在尝试检测Owl Carousel何时可以被操作,以便我可以添加内容。下面的脚本启动轮播,但初始化的事件永远不会触发。
<script type="text/javascript">
jQuery(document).ready(function () {
var owl = jQuery("#owl-example");
owl.on('initialized.owl.carousel', function(e) {
alert('hi');
}).owlCarousel({
navigation: true,
goToFirstSpeed: 2000,
singleItem: false,
transitionStyle: "fade",
items:<?=$_productCollection->getPageSize()?>,
lazyLoad: true,
autoWidth:true,
scrollPerPage:true,
mouseDrag:false,
touchDrag: false,
startPosition: "zero",
navigationText: [
"<strong><</strong>", //this equates to "<"
"<strong>></strong>" //this equates to ">"
]
});
;
});
</script>
答案 0 :(得分:7)
initialize.owl.carousel 和 initialized.owl.carousel 事件
查看文档https://owlcarousel2.github.io/OwlCarousel2/docs/api-events.html
的此链接答案 1 :(得分:1)