Skip to content

Instantly share code, notes, and snippets.

@sbussard
Created August 26, 2016 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sbussard/7796aac53012a40bf26a1d13135c8ee2 to your computer and use it in GitHub Desktop.
Save sbussard/7796aac53012a40bf26a1d13135c8ee2 to your computer and use it in GitHub Desktop.
A list of things, and something to do
Let's say you have a list of items, and something to do with each item. You want to be able to tell the system when to do the thing on an item, and to be able to select what item to do the thing on. For convenience sake, you want to be able to choose the next item or the previous item, or any item in the list (by index of course).
The difference between this and a reducer, for example, is that this system provides an interface for outside interaction.
Right now the class assumes that the list of items are dom elements, children of some parent element, and the task to be applied is toggling a css class. This is already useful for a wide variety of applications, including carousels, image sliders and slide shows. But essentially it only works on the front end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment