beyonk-group/svelte-carousel

Dots is not working properly when there is more than 1 item per page

johnyvelho opened this issue · 1 comments

Dots should work similarly as pagination. eg:

If we have 6 items, and we set perPage={2}, it should appear only 3 dots. However, is appearing 6 dots (one for each item), and this is causing a bug, as we can even see in the demo link in the READ.me:

https://svelte.dev/repl/3953567d530b41d087ab7eaa8e7e632a?version=3.22.3

We can see we have 4 items and 4 dots. but we should have only 2 dots.
4 / perPage(3 default) = Math.ceil(1.3) = 2.

We also can see that after dragging to right, the dots will remain without the class "active" until it gets to the item 0 again

Yeah that seems fair. we should be dividing the number of dots in this instance. Good catch!