1.0.7 • Published 6 months ago

scrollsnap-controls v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
6 months ago

Built With Stencil

\<scrollsnap-controls>

Helper for use with a CSS Scrollsnap element. Adds indicator buttons and handlers for Prev/Next buttons.

POC: Really rushed and unloved demo: https://codepen.io/georgeadamson/pen/VwPrwyY?editors=1100

Using this component

After adding a script you can use this compoennt just like any other html element.

Add a script tag similar to this:

<script type="module" src="https://cdn.jsdelivr.net/npm/scrollsnap-controls/dist/esm/scrollsnap-controls.min.js"></script>

...then you can use the element like this:

<scrollsnap-controls for="my-slider" prev="my-slider-prev" next="my-slider-next" polyfill aria></scrollsnap-controls>

| This component is an experimental POC with caveats...!

  • Only tested with horizontal scrollsnap.
  • Assumes all scroll items are the same width.

Props/Attributes for using \<scrollsnap-controls>

For latest see the component readme.

Properties

PropertyAttributeDescriptionTypeDefault
ariaariaOptional: When set, the component will toggle aria attributes on the scrollsnap elements. This can be helpful to screenreaders but scenarios vary.booleanundefined
currentDotcurrent-dotOptional: Specify a character or markup for the "current" page indicator dot.(() => void) \| string'🔘'
currentIndexcurrent-indexReadonly: Attribite to surface the index of the current page.number0
dotdotOptional: Specify a character or markup for an indicator dot.(() => void) \| string'⚪️'
htmlFor (required)forRequired: id or CSS selector for your scrollsnap element.stringundefined
keyskeysExperimental: When set, the component will attempt better paging of the scrollsnap using the ← → arrow keys.booleanundefined
nextnextOptional: id or CSS selector for your "Next" button.stringundefined
polyfillpolyfillOptional: When set, the component will fetch polyfills for browsers that do not support smoothscroll natively. (Eg Safari, Edge, IE11)booleanundefined
prevprevOptional: id or CSS selector for your "Previous" button.stringundefined

1.0.7

6 months ago

1.0.2

9 months ago

1.0.6

9 months ago

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.10

2 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.5

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago