回调事件不起作用-使用猫头鹰旋转木马



我正在尝试检测Owl旋转木马何时可以被操作,以便向其中添加内容。下面的脚本启动了旋转木马,但初始化的事件从未触发。

<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>&lt;</strong>", //this equates to "<"
                "<strong>&gt;</strong>" //this equates to ">"
            ] 
        });
        ;
    });
</script>

初始化.owl.coroundle已初始化.owl.caroundle事件必须在猫头鹰旋转木马初始化之前附加

检查文档的此链接https://owlcarousel2.github.io/OwlCarousel2/docs/api-events.html

您需要升级到新版本。

https://github.com/OwlCarousel2/OwlCarousel2/archive/2.2.1.zip

最新更新