Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lukewarlow/wc-horizontal-scroller

A web component for a horizontal scroller (carousel)
https://github.com/lukewarlow/wc-horizontal-scroller

carousel carousel-component component scroller webcomponent webcomponents

Last synced: 1 day ago
JSON representation

A web component for a horizontal scroller (carousel)

Awesome Lists containing this project

README

        

# Horizontal Scroller Web Component

[![npm](https://img.shields.io/npm/v/wc-horizontal-scroller.svg?style=flat-square)](https://www.npmjs.com/package/wc-horizontal-scroller)

A web component for a horizontal scroller (carousel)

### Install

```shell
$ npm i wc-horizontal-scroller
```
### Usage

Firstly, you need to register the custom element.

```js
import HorizontalScroller from "wc-horizontal-scroller";

window.customElements.define('horizontal-scroller', HorizontalScroller);
```

Then you can use it in your HTML. You must provide an ID for the element.

```html

Item 1

Item 2

```

#### Fullscreen

By default, clicking on the element will expand it to cover most of the viewport. This can be disabled by adding the `no-fullscreen` attribute to the custom element.

A `scrollerfullscreenenter` event will be dispatched by the element when entering fullscreen, and `scrollerfullscreenexit` when exiting fullscreen. See [index.html](https://github.com/lukewarlow/wc-horizontal-scroller/blob/master/index.html) for an example usage.

## License

This project is licensed under the [MIT License](https://github.com/lukewarlow/wc-horizontal-scroller/blob/master/LICENSE).