Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/tflx/throw-slider

Slider with throw effect
https://github.com/tflx/throw-slider

Last synced: about 2 months ago
JSON representation

Slider with throw effect

Awesome Lists containing this project

README

        

# throw-slider

Slider with throw effect

All credit goes to GSAP https://codepen.io/GreenSock/pen/ExdyYed

---

## Usage

### Install

```
npm i throw-slider
```

### Import

```
import 'throw-slider'
```

### Use

```


slide 1


slide 2


slide 3


slide 4


slide 5


slide 6


slide 7


slide 8


slide 9

```

### Options

| Attribute | Type | Default | Description |
| ----------------- | ------- | ------- | ---------------------------------------------------------------------------------- |
| `autoplay` | Boolean | false | Automatically moves |
| `speed` | Number | 1 | Speed of the autoplay. Higher is faster |
| `notDraggable` | Boolean | false | Remove the dragging option |
| `center` | Boolean | false | Active element is the one in the center of the container rather than the left edge |
| `noRepeat` | Boolean | false | Stop looping |
| `reversed` | Boolean | false | Moves in reverse |
| `noSnap` | Boolean | false | Don't snap on items |
| `noPauseOnHover` | Boolean | false | Don't pause autoplay on hover |
| `throwResistance` | Number | 3500 | Throw resistance, default is 3500 |

### Events

```
interface ThrowEvent {
currentItem: HTMLElement;
currentIndex: number;
}

"onChange": (event: CustomEvent) => void;
```