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