Eventsvar owl = $('.owl-carousel'); owl.owlCarousel(); // Listen to owl events: owl.on('changed.owl.carousel', function(event) { ... }) You could also trigger events by yourself to control Owl Carousel: var owl = $('.owl-carousel'); owl.owlCarousel(); // Go to the next item $('.customNextBtn').click(function() { owl.trigger('next.owl.carousel'); }) // Go to the previous item $('.customPrevBtn').click(function() { // With optional speed parameter // Parameters has to be in square bracket '[]' owl.trigger('prev.owl.carousel', [300]); })CallbacksInstead of attaching an event handler you can also just add a callback to the options of Owl Carousel. $('.owl-carousel').owlCarousel({ onDragged: callback }); function callback(event) { ... }DataEach event passes very useful information within the event object . Based on the example above: function callback(event) { // Provided by the core var element = event.target; // DOM element, in this example .owl-carousel var name = event.type; // Name of the event, in this example dragged var namespace = event.namespace; // Namespace of the event, in this example owl.carousel var items = event.item.count; // Number of items var item = event.item.index; // Position of the current item // Provided by the navigation plugin var pages = event.page.count; // Number of pages var page = event.page.index; // Position of the current page var size = event.page.size; // Number of items per page }Carouselinitialize.owl.carouselType: attachable When the plugin initializes. initialized.owl.carouselType: attachable When the plugin has initialized. resize.owl.carouselType: attachable When the plugin gets resized. resized.owl.carouselType: attachable When the plugin has resized. refresh.owl.carouselType: attachable, cancelable, triggerable When the internal state of the plugin needs update. refreshed.owl.carouselType: attachable When the internal state of the plugin has updated. drag.owl.carouselType: attachable When the dragging of an item is started. dragged.owl.carouselType: attachable When the dragging of an item has finished. translate.owl.carouselType: attachable When the translation of the stage starts. translated.owl.carouselType: attachable When the translation of the stage has finished. change.owl.carouselType: attachable When a property is going to change its value. changed.owl.carouselType: attachable When a property has changed its value. next.owl.carouselType: triggerable Goes to next item. prev.owl.carouselType: triggerable Goes to previous item. to.owl.carouselType: triggerable Goes to position. destroy.owl.carouselType: triggerable Destroys carousel. replace.owl.carouselType: triggerable Removes current content and add a new one passed in the parameter. add.owl.carouselType: triggerable Adds a new item on a given position. remove.owl.carouselType: triggerable Removes an item from a given position. Lazyload.owl.lazyType: attachable When lazy image loads. loaded.owl.lazyType: attachable When lazy image has loaded. Autoplayplay.owl.autoplayType: triggerable Runs autoplay. stop.owl.autoplayType: triggerable Stops autoplay. Videostop.owl.videoType: attachable When video has unloaded. play.owl.videoType: attachable When video has loaded. |