1.0.9 • Published 10 months ago

@joinbox/slider v1.0.9

Weekly downloads
-
License
ISC
Repository
-
Last release
10 months ago

Slider

Simple slider for scrollable panes. Does

  • support scroll buttons (previous/next) anywhere in the DOM
  • update scroll button visibility depending on scroll position
  • make sure that an active element is visible on initialization

Polyfills

Example

<div class="back">←</div>
<slider-component
    data-previous-button-selector=".back"
    data-next-button-selector=".forward"
    data-disabled-button-class-name="disabled"
    data-active-content-selector=".active"
>
    <div class="element">Test</div>
    <div class="element">Test</div>
    <div class="element">Test</div>
    <div class="element active">Test</div>
    <div class="element">Test</div>
</slider-component>
<div class="forward">→</div>

<script type="module" src="@joinbox/slider/SliderElement.js"></script>

Components

Slider Component

Exposed Element

<slider-component></slider-component>

Attributes

  • data-previous-button-selector (optional): CSS selector for the button that scrolls to the previous view. The button may be placed anywhere in the DOM.
  • data-next-button-selector (optional): See data-previous-button-selector, but for the next view.
  • data-disabled-button-class-name (optional): Class name that should be added to buttons that are disabled (depending on the scroll position; if the scroll position is 0, this class will be added to the previous button, as user cannot scroll any more towards the previous view).
  • data-active-content-selector (optional): CSS selector for the active element; the element must be a child of <slider-component> and will be scrolled into view on initialization.
1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.1-alpha.1

3 years ago