Skip to content

Wrong behaviour for slider with two slides #79

@honzabilek4

Description

@honzabilek4

Hi,

While having slider with only two slides and carousel on, you can notice that the isForward variable is always wrong on the second slide. This causes the silder to animate the other direction than expected.

It's the same issue as mentioned in #43, wich was solved only partially.

This happens due to the ambiguity of the next / previous slides. It's the same index (0) in fact and therefore it is impossible to decide the direction here:

var isForwards = (index > this.currentItemIndex || index === 0 && this.currentItemIndex === this.lastItemIndex) && !(index === this.lastItemIndex && this.currentItemIndex === 0);
or here

One option is to determine the direction right in the next() and previous() functions and then use it in goTo().

Anyone has a better idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions