vUX / ListScroller / v4.1.0

A row wider than the page, two buttons to move it.

Hand ListScroller a <ul>, the element around it and your own two buttons. It lays the list out in one scrollable row, moves it a step per press, and keeps each button's inactive state matched to where the row really is, however it got there.

new ListScroller(box, list); ls.config.buttons = [prev, next]; ls.initialize(); ls.onScroller();
0 / 0 px
  • 01Carousel
  • 02SPAEngine
  • 03DataView
  • 04ModalDisplayer
  • 05FormComponents
  • 06TimeLineList
  • 07Resizer
  • 08AutoWriter
  • 09ToolTip
  • 10Component

01Playground

Every config property, live. ListScroller reads the step, the speed and the paddings on each use, so those apply straight away. Swapping the inactive class or turning the buttons off also works on a running scroller. offScroller() parks both buttons until onScroller().

configlistening
Equivalent code

                
Stagerunning
    scrollLeft0
    max0
    left button–
    right button–
    initialize(); onScroller();

    02The buttons follow the list

    The row is a real scroll area. Swipe it, use a trackpad or Shift + wheel, or drag the frame's corner to make it narrower. ListScroller measures the actual scroll position each time, so the buttons never claim there is more to see when there isn't. Items added later widen the row by themselves.

    03No buttons at all

    With config.hasButtons = false ListScroller only does the layout: one row, no wrapping, its scrollbar hidden. Swiping, the trackpad and Shift + wheel still scroll it. That suits a filter bar on a phone.

    Filterstouch or trackpad to scroll

      04Bad input fails immediately

      The constructor and the config setters throw on the spot and name what is wrong. initialize() throws when the buttons or their inactive class are missing. Each button below makes one of these mistakes on a scratch instance and prints what was thrown.

      Pick a mistake above.