A
A
ALexLancer2020-04-19 01:29:40
Owl Carousel
ALexLancer, 2020-04-19 01:29:40

Why does calling owl.data('owlCarousel') return undefined?

I'm using version 2. The carousel works fine except for one thing. Required to get the carousel properties object. This method is recommended, but it returns an empty result.

owl = $('.owl-carousel');
  owl.owlCarousel({ 
      loop           : true,
      margin         : 20,
      nav            : true,
      smartSpeed     : 500,
      dots           : false,
      responsive:{
        0:{
          items : 1
        },
        767:{
          items : 2
        },
        1200:{
          items : 3
        },
  });
  let options = owl.data('owlCarousel');

Why does calling owl.data('owlCarousel') return undefined?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2020-04-19
@ALexLancer

Because it will be right . .data('owl.carousel')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question