Define owl carousel parameters in HTML (with class or data attribute)
问题 I have a page with few owl carousels. I would like to be able to set some parameters for these owl carousels in HTML code (using a class or data attribute). Assuming I have two data attributes defined in my HTML, I have created following jQuery code: $(".owl-carousel").each(function( index ) { var items_no = $(this).data('slides'); var autoplay = $(this).data('autoplay'); $(".owl-carousel").owlCarousel({ items : items_no, autoplay: autoplay }); }); And as you may expect it is not working. The