Callback events not working - using Owl Carousel
Asked Answered
T

2

6

I am trying to detect when Owl Carousel is ready to be manipulated so that I can add content to it. The script below initiates the carousel but the initialized event never triggers.

<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>
Tisza answered 5/2, 2015 at 23:6 Comment(0)
B
9

initialize.owl.carousel and initialized.owl.carousel events must be attached before Owl Carousel initialization

Check this link of the documentation https://owlcarousel2.github.io/OwlCarousel2/docs/api-events.html

Bouncy answered 6/8, 2015 at 2:41 Comment(0)
S
1

You need to upgrade to the new version.

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

Salim answered 2/12, 2015 at 16:48 Comment(1)
Please identify the changes and notify the user who has asked the question about itMountfort

© 2022 - 2024 — McMap. All rights reserved.