beyonk-group / svelte-carousel

A super lightweight, super simple Carousel for Svelte 3
MIT License
213 stars 38 forks source link

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

Closed johnyvelho closed 4 years ago

johnyvelho commented 4 years ago

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

antony commented 4 years ago

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