darsain / sly

JavaScript library for one-directional scrolling with item based navigation support.
http://darsa.in/sly
2.87k stars 497 forks source link

Fix problem with next() method. #214

Closed skamril closed 9 years ago

skamril commented 9 years ago

Fix problem with next() when last item is activated.

darsain commented 9 years ago

This makes .next() method move to 1st element when reaching the end. I don't know if this is desirable.

But even if it would, you are ignoring .prev() method, which won't have similar logic.

You also introduced a bug. When there is no activeItem defined, it'll try to add 1 to undefined value. That's why there is currently the rel.activeItem == null check.


We can have a discussion whether prev/next methods should loop in another issue, but this PR is not gonna get merged. Sorry for the delay btw :neutral_face:

skamril commented 9 years ago

I think it would be interesting to add an optional parameter to .next() and .prev() methods for allowing loop.