Update docs

This commit is contained in:
Vadim
2021-06-29 11:29:20 +03:00
parent f2cf47b8d4
commit d12fc14fdf
2 changed files with 47 additions and 4 deletions

View File

@@ -186,6 +186,8 @@
## Use case
<AlbumsPreview />
<Divider />
# Installation
```bash
yarn add svelte-carousel
@@ -202,7 +204,10 @@ Import component
</script>
```
<Divider />
# Props
<div class="table-wrapper">
| Prop | Type | Default | Description |
@@ -220,7 +225,9 @@ Import component
</div>
# Event
<Divider />
# Events
## `pageChange`
Is dispatched on page change
@@ -243,6 +250,8 @@ Is dispatched on page change
</Carousel>
```
<Divider />
# Slots
## `prev` and `next`
@@ -329,6 +338,41 @@ Slot props:
<Divider />
# Methods
## `goTo`
Navigates to a page by index
Arguments:
<div class="table-wrapper">
| Argument | Type | Default | Description |
|--------------------|-------------|---------|---------------------------------------|
| `pageIndex` | `number` | | Page number |
| `options.animated` | `boolean` | `true` | Should it be animated or not |
</div>
```jsx
<script>
// ...
let carousel;
function goToStartPage() {
carousel.goTo(0, { animated: false })
}
</script>
<Carousel
bind:this={carousel}
>
<!-- -->
</Carousel>
<button class="button" on:click={goToStartPage}>Go</button>
```
<Divider />
<style>
.img-container {
display: block;