I have a page with multiple sliders that are created with owl carousel. I would like to define different number of visible items for each slider. The perfect solution would be to define number of visible items in HTML (as a class or data). I am just starting using jQuery so I only managed to pass a value using data attribute like this:
<div class="owl-carousel" data-itemsnumber="5">...</div>
Then I applied this value to a variable in JS and add this variable in settings instead of items number like this.
var slides = $('.owl-carousel').data('itemsnumber');
$(".owl-carousel").owlCarousel(
{
items: slides
});
The above code is not working properly as value from first slider is applied to all sliders on page, and I need each of them to have different number of items. How can I achieve this?
Thanks in advance
Best Answer
There are some pre-defined options defined in owl-carousels:
You could use the above options to set how many items would be shown according to the screen width. some what like this:
Also if you are using the carousels for images, then images might overlap at different screens. so you could make the width of images 100% in your css file.