Fix carousel not working when item is deleted or no items at all

This commit is contained in:
Niko 2022-02-16 21:28:44 +01:00
parent 4b494dcc7a
commit 5075a218b5
1 changed files with 5 additions and 0 deletions

View File

@ -21,6 +21,11 @@ app.carousel = {
const elements = mod._elements();
const current = elements[mod._current];
const next = elements[i];
if (next === undefined) {
if (i > 0)
return app.carousel.set(mod, 0);
return false;
}
var direction = 'none';
if (i > mod._current)
direction = 'right';